mswjs / interceptors

Low-level network interception library.
https://npm.im/@mswjs/interceptors
MIT License
539 stars 123 forks source link

fix: unify server error response across interceptors #555

Closed kettanaito closed 5 months ago

kettanaito commented 5 months ago

If you want to emulate a request error, do request.respondWith(Response.error()).

kettanaito commented 5 months ago

Hi, @mikicho 👋 If you have a minute, can I ask for your opinion on this?

This is a bit related to handling response stream errors. I'd like to hear your thoughts on this exception handling and if it makes sense to you. Thanks!

kettanaito commented 5 months ago

This is what I eventually ended up with. I think it makes the most sense and makes the exception handling predictable.

mikicho commented 5 months ago

This is great! More context from discussion in Nock: https://github.com/nock/nock/issues/2211

kettanaito commented 5 months ago

Released: v0.28.3 🎉

This has been released in v0.28.3!

Make sure to always update to the latest version (npm i @mswjs/interceptors@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.