v2.3.0
v2.3.0 (2024-05-08)
Warning
This release changes how MSW treats unhandled exceptions in response resolvers. Previously, they were treated as request errors. Starting with this release, unhandled resolver exceptions will be coerced to 500 Unhandled Exception
mocked error responses produced by the library. Please note that you must not intentionally throw errors in your resolvers. Please use Response.error()
to mock request/network errors. Unhandled exceptions are considered unintended and will be treated as if they happen on the actual server.
Features
- treat unhandled exceptions in handlers as 500 error responses (#2135) (5191399) @kettanaito
- prioritize the
node
export when importingmsw/node
(#2134, transitively through @mswjs/interceptors). - add a new
unhandledException
event (#2135, docs).
server.events.on('unhandledException', ({ request, error }) => {
console.log('%s %s errored! See details below.', request.method, request.url)
console.error(error)
})
Bug Fixes
- Disposable: make the ".dispose()" method synchronous (#2144) (686d3d6) @kettanaito