-
Notifications
You must be signed in to change notification settings - Fork 24
Conversation
// If we have a rendering engine don't show the | ||
// default feathers error page. | ||
if (req.app.get('view engine') !== undefined) { | ||
if (err.code === 404) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is having the error pages in /404 and /500 a common assumption?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is a reasonable one. Typically apps have a 404 and a 500 page. Ideally I would like it to be more configurable as to whether you want to disable the redirection altogether. Maybe on initialization of the feathers-error middleware?
Nevermind the comment. Looks good if based on an existing middleware. Can I opt out of the default error pages though? |
@daffl the only way to opt out right now is to either not use the handler and use your own or to have a template engine registered with the app. My thought was if you have a view engine then we should redirect to a 500 or 404 route. |
Well actually if someone wants HTML and we don't serve it, it makes sense to actually show an HTML page. Only thing is, can we test this? |
I manually tested it. In an automated way I guess we probably could by making a request in a test and then comparing the result to an html fixture. |
Inspired by the express error handler but with some minor modifications. I'm wondering if checking for a view engine is the right thing to do here.