skipcheck

TM1 client · Docs · Errors

ODataError

import { ODataError } from "@skipcheck/tm1-client";

An OData error response body: {"error":{"code":"278","message":"..."}}.

TM1 uses code 278 for most errors (not found, bad request, precondition failed and not implemented alike), so the code alone rarely identifies an error. See Tm1ErrorClassifier.

Members

code propertyTM1's error code, or empty.
message propertyTM1's message, or empty.
target propertyWhat the error applies to, or undefined.
details propertyFurther errors, or empty.
innerError propertyServer-specific details as TM1 sent them, or undefined.
ODataError constructorAn OData error response body.
from staticThe error in a parsed JSON body, wrapped in error or not; undefined if it isn't one.
fromText staticThe error in a plain-text body, as TM1 sends some (its Error.
parse staticThe error in a response body, whatever its form.
equalsWhether other is the same error.
toStringThe error's code and message, for logs.

code

property
code: string

TM1's error code, or empty.

message

property
message: string

TM1's message, or empty.

target

property
target: string | undefined

What the error applies to, or undefined.

details

property
details: readonly ODataError[]

Further errors, or empty.

innerError

property
innerError: unknown

Server-specific details as TM1 sent them, or undefined.

ODataError

constructor
constructor(code: string | null | undefined, message: string | null | undefined, target?: string, details?: readonly ODataError[], innerError?: unknown)

An OData error response body: {"error":{"code":"278","message":"..."}}. TM1 uses code 278 for most errors (not found, bad request, precondition failed and not implemented alike), so the code alone rarely identifies an error: see Tm1ErrorClassifier. A null code or message reads as empty.

from

static
static from(body: unknown): ODataError | undefined

The error in a parsed JSON body, wrapped in error or not; undefined if it isn't one.

fromText

static
static fromText(body: string): ODataError | undefined

The error in a plain-text body, as TM1 sends some (its Error: lines dropped, the rest joined on one line and cut at 1000 characters); undefined if there's no text.

parse

static
static parse(body: Uint8Array | string | null | undefined): ODataError | undefined

The error in a response body, whatever its form: JSON, then plain text; undefined if empty.

equals

equals(other: unknown): boolean

Whether other is the same error: code, message, target, details and inner error alike.

toString

toString(): string

The error's code and message, for logs.