ShiftWise API Docs
    Preparing search index...

    Module errors

    Centralised HTTP error handling for the ShiftWise API.

    All route handlers throw AppError instances (or use the convenience factory functions) instead of calling res.status().json() directly. The global error handler in index.ts catches everything and returns a consistent { error, code } JSON response.

    // In a route handler:
    if (!user) throw Unauthorized('Invalid credentials')
    if (exists) throw Conflict('Email already in use')

    Classes

    AppError

    Functions

    BadRequest
    Conflict
    Forbidden
    Internal
    NotFound
    Unauthorized