-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
feat: treat unhandled exceptions in handlers as 500 error responses #2135
Conversation
Need to adjust some tests to reflect the Interceptors change. |
The problem was that we throw an error in I've merged mswjs/interceptors#566 to allow us to opt-out from that default behavior and handle our internal errors differently (e.g. by forwarding them to the process). |
src/core/utils/internal/devUtils.ts
Outdated
@@ -29,3 +29,7 @@ export const devUtils = { | |||
warn, | |||
error, | |||
} | |||
|
|||
export class InternalError extends Error { | |||
// |
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.
Okay now, this is embarrassing.
* forwarding the actual rejection in the "error.cause" property. | ||
*/ | ||
expect(requestError.cause).toEqual( | ||
expect(requestError).toEqual( | ||
new Error( | ||
'[MSW] Cannot bypass a request when using the "error" strategy for the "onUnhandledRequest" option.', |
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.
This is a correct "breaking" change. Errors originating from MSW must not be treated as request errors.
Released: v2.3.0 🎉This has been released in v2.3.0! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
While I don't love the breaking change with a minor rev, this is a good change! |
node
export condition higher priority #2134, fix: givenode
export condition higher priority interceptors#552Todo