Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Wouldn't it be great if you could do:
error = Boom.notFound() error.isClient // => true error = Boom.notImplemented() error.isClient // => false
What do you think?
error = Boom.notFound() Boom.isClient(error) // => true error = Boom.notImplemented() Boom.isClient(error) // => false
What is the use case for this?
While I understand what you're saying about the difference between 400 and 500 errors, that could get into a sort of gray area - if you request a page that doesn't exist (404) whose fault is it really? Is it because an HTML file couldn't be found on disk? Is it because the requestor requested something that doesn't exist? In the former, that would be a server error, the latter a client request. How would you be able to programmatically determine that?
I've implemented a Boom-compatible error middleware for express.
I know, we're not using Hapi, don't ask :|
I'd like to implement another express middleware to log errors, but only if the error has a
More from the HTTP/1.1 spec about client vs. server errors:
Totally willing to chat about where the fault might really lie for a 404, but if you have a preferred other way to discern between 4xx and 5xx errors, let's just go with that.