2.3.2 (2023-01-11)
🐛 Bug fix(es)
Allows defining global error catchers using resolvers:
const request = wretch(baseURL)
.errorType("json")
.resolve((response) => {
return (
response
.error("Error", (error) => {
console.log("global catch (Error class)");
})
.error("TypeError", (error) => {
console.log("global type error catch (TypeError class)");
})
);
});
await request
.get(`/carts/v3/${cartId}/payment/modes`)
// Will override the global catcher now thanks to this fix.
.notFound((error) => {
console.log("not found");
})
.json();