From d7b203f3a7198138b693756a83aacac9ba598a8b Mon Sep 17 00:00:00 2001 From: Ryan-Zayne Date: Wed, 15 Jan 2025 22:54:21 +0100 Subject: [PATCH] . --- docs/content/docs/v1/error-handling.mdx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/content/docs/v1/error-handling.mdx b/docs/content/docs/v1/error-handling.mdx index 4ade2a5..815402e 100644 --- a/docs/content/docs/v1/error-handling.mdx +++ b/docs/content/docs/v1/error-handling.mdx @@ -11,3 +11,12 @@ CallApi by default returns response errors and request errors as a value. The er 1. `errorData`: The error data, which can either be an error response from the API or a standard JavaScript error object. 2. `name`: The name of the error (e.g., 'TypeError', 'SyntaxError', 'HTTPError'). 3. `message`: The error message describing what went wrong. + +```ts twoslash title="fetch.ts" +import { callApi } from "@zayne-labs/callapi"; + +const { error } = await callApi("https://jsonplaceholder.typicode.com/todos/1"); +// @annotate: Hover over the error object to see the type +``` + +## Custom Error Type