Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan-Zayne committed Jan 15, 2025
1 parent 445c87b commit d7b203f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/content/docs/v1/error-handling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d7b203f

Please sign in to comment.