-
-
Notifications
You must be signed in to change notification settings - Fork 128
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
controller.errorWith ends up in the response path if the error is not Error instance #625
Comments
I have the same issue currently when using |
@marikaner In order to keep this issue clean, I opened an issue in |
I think it should be safe to allow arbitrary error reasons. The only thing, I'd be careful with the I'd probably suggest to refactor
The current interceptors/src/utils/handleRequest.ts Lines 74 to 77 in 472bcbe
We can likely keep the existing @mikicho, would you like to give this one a try? |
Sure! I'd love to contribute to this one... |
@kettanaito I need clarification on what you have in mind. export async function handleRequest(options) {
const handleResponse..
const handleResomposeError..
...
const result = await until...
if (result.error)... // a.k.a onReject
if (result.data)... // a.ka onResolve
} |
Right now we have cases where rejections can be translated to successful response handling: interceptors/src/utils/handleRequest.ts Line 76 in 7e62e17
And successful responses translated to errors: interceptors/src/utils/handleRequest.ts Lines 47 to 53 in 7e62e17
This all is intended but reading it is a bit confusing. So I proposed to have higher-level |
interceptors
expects the error to be from typeError
inhandleRequest
, which is not required by Node.If the interceptor is applied, the program prints
response
and throws:For real requests, it is called the
error
callback.WDYT?
The text was updated successfully, but these errors were encountered: