-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improves logging for explicitly handled errors #694
Conversation
…nd notImplemented error
Amphora provides a mechanism to supply an error status code and message in a response. This is accomplished by setting the following properties on an **Error**: ```js const err = new Error('Invalid Request'); err.status = 400; err.message = 'Invalid Request'; throw err; ``` Errors thrown in a model's `render` or `save` will make their way to the main error handler defined in `lib/responses.js`. Prior to this commit, those errors were not logged, leaving the logging up to the implementer.
@Tiffachow PR I incorporated your commits from #693 and combined them with some additional logging changes that were requested here. Since #693 was opened from an older fork there were conflicts with earlier changes that added |
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.
Thanks matt looks good to me
This commit is unrelated to the primary purpose of this branch, but the unused variable is causing the linter to fail.
This pull request incorporates elements of #693 with a few additional changes:
origin/master
to handle merge conflicts for existing logging updates.composer.js
when an error has a.status
(leaving the logging up to the error handler inresponses.js
)..status
property at thewarn
(4xx) orerror
(5xx) level.Change (1) pulls in a previous commit that added URLs to response logs.
Change (2/3) will allow dynamic routes to return 404s/400s without logging at the
error
level.