Skip to main content

Overview

The Cuey TypeScript client provides typed error classes for different error scenarios. All errors extend from CueyError and include status codes and error details.

Error Classes

CueyError

Base error class for all Cuey API errors.
class
Base error class extending JavaScript’s Error.

UnauthorizedError (401)

Thrown when the API key is invalid or missing.
class
Extends CueyError. Thrown when authentication fails.

NotFoundError (404)

Thrown when a requested resource doesn’t exist.
class
Extends CueyError. Thrown when a resource is not found.

BadRequestError (400)

Thrown when the request is invalid (e.g., trying to update a non-pending event).
class
Extends CueyError. Thrown when the request is invalid.

ValidationError (400)

Thrown when request validation fails. Includes detailed validation errors.
class
Extends CueyError. Thrown when request validation fails.

InternalServerError (500+)

Thrown when a server error occurs (e.g., requesting an out-of-range page).
class
Extends CueyError. Thrown when a server error occurs.

Error Codes

union
Union type of all possible error codes.

Basic Error Handling

Try-Catch Pattern

Handling Validation Errors

Validation errors include detailed information about what failed:

Common Error Scenarios

Invalid API Key

Resource Not Found

Invalid Request Data

Updating Non-Pending Event

Out of Range Pagination

Error Handling Utilities

Generic Error Handler

Retry on Specific Errors

Error Type Guards

Best Practices

Always Handle Errors

Provide User-Friendly Messages

Importing Error Classes

Types Reference

See all available types.

Advanced Configuration

Learn about advanced configuration options.

REST API Errors

See REST API error responses.