github elbywan/wretch 2.3.2

latest releases: 2.10.0, 2.9.1, 2.9.0...
20 months ago

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

Don't miss a new wretch release

NewReleases is sending notifications on new releases.