Skip to content

v2.3.0

Latest
Compare
Choose a tag to compare
@kettanaito kettanaito released this 08 May 14:11
· 1 commit to main since this release

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 importing msw/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