fix: Improve error logging for axios errors#120
Conversation
| // if the axios error is incomplete | ||
| // for any reason, we don't want | ||
| // error handling to fail | ||
| errorBody = error; |
There was a problem hiding this comment.
It's pretty common for axios errors to not have.response e.g. when there's a network error or timeout. These errors will have .request but not .response. So would probs be good to handle those cases without just using the full error.
Also, would be good to keep error.message too maybe?
There was a problem hiding this comment.
Oh and maybe some of the request info can be kept, might be useful in development? E.g. url, payload, headers, query parameters etc
There was a problem hiding this comment.
Oh and maybe some of the request info can be kept, might be useful in development? E.g. url, payload, headers, query parameters etc
They come with error.config
There was a problem hiding this comment.
It's pretty common for axios errors to not have
.responsee.g. when there's a network error or timeout. These errors will have.requestbut not.response. So would probs be good to handle those cases without just using the full error.Also, would be good to keep
error.messagetoo maybe?
Good points. On it!
There was a problem hiding this comment.
Nice one. Good to know re .config
Axios errors are really verbose and local development terminals get spammed, especially if more than one test fail because of HTTP errors. While handling an error, lambda wrapper should recognise axios errors and trim down the information to the request config, response.status and response.data See: - [ENG-115]
b08c322 to
11ac8d2
Compare
|
🎉 This PR is included in version 1.2.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Axios errors are really verbose and local development terminals get spammed, especially if more than one test fail because of HTTP errors.
While handling an error, lambda wrapper should recognise axios errors and trim down the information to the request config, response.status and response.data
See: