An error answered by the server with a status and a message: thrown by endpoints and middlewares on the server (estuary-rpc-server answers it as { status: "error", message } with its status), and by estuary-rpc-client when a call is answered so, with the status kept.

Example

if (!book) throw new ApiError(HTTP_STATUS_CODES.NOT_FOUND, "No such book");

Hierarchy

  • Error
    • ApiError

Constructors

  • Parameters

    • status: number
    • Optional message: string

    Returns ApiError

Properties

message: string
name: string
stack?: string
status: number
prepareStackTrace?: ((err: Error, stackTraces: CallSite[]) => any)

Type declaration

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void

  • Whether a value is an ApiError, even one made by another copy of estuary-rpc (two installs, or a bundler's copy beside Node's), where instanceof says no.

    Parameters

    • error: unknown

    Returns error is ApiError

Generated using TypeDoc