Skip to content
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

Include request object in HTTPError #287

Closed
ialexi-bl opened this issue Oct 19, 2020 · 2 comments · Fixed by #309
Closed

Include request object in HTTPError #287

ialexi-bl opened this issue Oct 19, 2020 · 2 comments · Fixed by #309
Labels
enhancement New feature or request

Comments

@ialexi-bl
Copy link
Contributor

I would suggest attaching request object to HTTPError. It would be useful to log request body, credentials policy etc. For now I have to use a custom http error, which leads to some problems with retry logic, so now I have to write a beforeRetry hook that checks whether request should be retried or not. It doesn't seem to do any damage to include request in HTTPError, so why not to do it? Also you could include options as well, because after normalization they could be used for logging as well

@sholladay
Copy link
Collaborator

sholladay commented Oct 22, 2020

I'm fine with this. Though, the hooks already receive the request and response, so in many cases it wouldn't make a difference. But it is a nice convenience to have those on the error.

@ialexi-bl
Copy link
Contributor Author

@sholladay, hooks receive request, but errors aren't always handled in hooks. Maybe some particular part of an application may want to log one request that failed unexpectedly, or in React apps error may get to error boundary which wants to log it, but can't do it, because it doesn't know the details of the request, so that would be helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants