Express EJS Layout intercept error
See original GitHub issueHello,
I have a strange issue, it seems that each time there is an error in my app (wherever it is), the plugin intercepts the error and print out something really not helping.
It is exactly as this stack overflow question: http://stackoverflow.com/questions/25433238/express-layouts-error-variable-not-defined
Comment say: express-ejs-layouts drives me crazy with this. If anything goes wrong in the controller or view, it reports that the first variable referenced in the view or layout is undefined. Basically I can never trust the error messages I get when using express-ejs-layouts.
And this is exactly the issue I have. It is really hard to debug the app because of that…
Any idea?
Thanks 😃
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Error handling - Express.js
Error Handling refers to how Express catches and processes errors that occur both synchronously and asynchronously. Express comes with a default error ......
Read more >express-ejs-layout sometimes fails to detect passing argument
I am rendering a page where I am passing data "userInfo" but sometimes it render and sometimes it shows this ReferenceError, not sure...
Read more >Error handling in Node.js with Express - DEV Community
Beside from the user experience, it is a good practice to catch errors in one place (all the errors go through the handler)...
Read more >Best Practices for Node.js Error-handling - Toptal
This article will introduce you to error-handling in Node.js and ... Knowing the basics about handling errors in Express.js middleware would certainly help....
Read more >Node.js v19.3.0 Documentation
Error propagation and interception. Error-first callbacks. Class: Error. new Error(message[, options]); Error.captureStackTrace(targetObject[ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There’s nothing wrong with express-ejs-layouts here.
The reason why you see “title is not defined” as the error is because that is the actual error.
Your app is catching the initial error and then rendering an error page, which also uses the layout, but you’re not defining
res.locals.title = 'Some error title'
in the error handler.No worries Regis, happens to all of us 👍