@triply/triplydb
    Preparing search index...

    Class TriplyDbJsError

    The error thrown by every failing call in this library.

    Catch it to inspect TriplyDbJsError.statusCode, which carries the HTTP status the API responded with. Not constructed by callers.

    Every error this library throws is one of these, IncompatibleError included, so a single instanceof TriplyDbJsError is enough to catch them all.

    Hierarchy (View Summary)

    Index
    context: Context = {}

    What the library was doing when this failed — the dataset, account or URL involved.

    statusCode?: number

    HTTP status for this failure, when there is one.

    Usually what the instance replied with; for a failure the library decides on locally it is the status that failure corresponds to.

    • Records what this error came from, so the underlying failure is not lost.

      Parameters

      • error: Response | Error | CachedResult
      • OptionaljsonResult: any

      Returns TriplyDbJsError

      Takes a response as readily as an error, since most failures here begin as one.

    • Replaces the message, scrubbing any token out of the replacement. Returns this error.

      Parameters

      • msg: string

      Returns TriplyDbJsError

    • Sets TriplyDbJsError.statusCode. Returns this error.

      Parameters

      • statusCode: number

      Returns TriplyDbJsError

      Not only for statuses an instance replied with: the library also uses it for a failure it decides on locally, such as the 409 for an asset name that is already taken.