To display the error like any other thrown errors in the console (red highlight), you can use console.error instead of console.log.
console.error
console.log