-
-
Notifications
You must be signed in to change notification settings - Fork 916
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
Custom errors thrown in afterResponse are suppressed #1352
Comments
This behavior is intended as the Got errors provide useful properties for debugging. Instead of overwriting the error, we could write into it. |
@szmarczak that makes sense... I'd rather we treat the errors as immutable (otherwise you can end up in a right old mess with Typescript!) How about we keep a reference to the |
Just also noticed from the error that only the timings are attached to the error - how can I access the underlying request or response when my afterResponse handler throws an error? Might be worth attaching |
Actually if it's missing request and response properties at this point then it's a bug... It should have that already. |
You're right, sorry about the last comment, didn't even check - it's there but non-enumerable already so didn't show up in my |
Closing in favor of #1353 |
Describe the bug
If my
afterResponse
hook throws a custom error, I'm not expecting it to be rewritten into a Got Request ErrorActual behavior
Error is rewritten as a RequestError, with no reference to the original error
Expected behavior
Original error is thrown
Code to reproduce
This will throw -
Checklist
The text was updated successfully, but these errors were encountered: