Skip to content

2.3.2

Compare
Choose a tag to compare
@elbywan elbywan released this 11 Jan 13:24
· 91 commits to master since this release

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();