Get Started

Error Handling


Overview

When the fetch response is not OK (response.ok), Zeta will throw a RequestError.

You can get the error message and status code like so:

try {
  await client.fetch("GET", "/unknown", {});
} catch (error: RequestError) {
  const { status, message } = error.response;
  console.error(error, { status, message });
}