# Error Handling — BrandApp Playground

> The SDK error hierarchy, the diagnostic payload, and how to map errors onto HTTP responses.

- Canonical page: https://brandapp-playground.vercel.app/errors
- Markdown: https://brandapp-playground.vercel.app/errors.md
- SDK module: `@reopt-ai/brandapp-sdk`

## Type guards

- `isReoptSDKError(err)` — structured SDK errors
- `isValidationError(err)` plus `toFieldMap(err)` — field-level validation errors

## Classes

`BadRequestError` (400), `AuthError` (401), `ForbiddenError` (403), `NotFoundError` (404),
`ConflictError` (409), `ValidationError` (422), `RateLimitError` (429), `ServerError` (500),
plus the AI-specific `CreditLimitError` (402), `ModelAccessError` (403),
`ModelNotFoundError` (404), and `ContentFilterError` (422).

## Diagnostic

Every structured error carries `{ cause, fix, envVar?, doc? }`, so a failure tells you what
to change rather than only what broke. The live demo throws real instances and shows the
`name`, `status`, `code`, `context`, and `diagnostic` your `catch` block will receive.

## Related

- [Health Check](https://brandapp-playground.vercel.app/health.md)
- [Webhooks](https://brandapp-playground.vercel.app/webhooks.md)
- [Testing Utilities](https://brandapp-playground.vercel.app/testing.md)

---

Index of every document: https://brandapp-playground.vercel.app/llms.txt
Single-file copy: https://brandapp-playground.vercel.app/llms-full.txt
HTTP API description: https://brandapp-playground.vercel.app/openapi.json
