> ## Documentation Index
> Fetch the complete documentation index at: https://traceryn.online/llms.txt
> Use this file to discover all available pages before exploring further.

# Error handling

> Pinto error classes and how to handle not-found, blocked, rate-limited, and network errors.

All errors extend `PintoError` and carry a `status` and a `code`.

| Error | Status | Meaning |
| - | - | - |
| `NotFoundError` | 404 | The pin, board, or user doesn't exist. |
| `BlockedError` | 403 | Pinterest blocked the request. |
| `RateLimitError` | 429 | Throttled. Carries `retryAfterMs`. |
| `NetworkError` | | Network-level failure. Carries `cause`. |
| `ParseError` | | The response couldn't be parsed. |

`errorForStatus` is also exported.

## Example

```ts theme={null}
import {
  PintoError,
  NotFoundError,
  BlockedError,
  RateLimitError,
} from "@traceryn/pinto";

try {
  await pinto.getPin(url);
} catch (err) {
  if (err instanceof NotFoundError) {
    // handle missing pin
  } else if (err instanceof RateLimitError) {
    // back off for err.retryAfterMs
  } else if (err instanceof BlockedError) {
    // cool this session down or rotate the pool slot
  } else if (err instanceof PintoError) {
    // err.status, err.code
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.