skipcheck

TM1 client · Docs · Errors

Tm1ErrorClassifier

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

Works out a Tm1ErrorKind from an error response.

TM1's error codes rarely say what went wrong: code 278 covers most failures. So classification is a table of rules, tried in order, matching on HTTP status, code and message. The first match wins, and the HTTP status decides when nothing matches. Matching on message text is a last resort, but TM1 gives nothing better for several errors (impersonation failures, for instance).

The table is data: defaults holds the rules this client knows, and withRule adds your own in front of them, e.g. for a message your TM1 version phrases differently.

Members

defaults staticThe rules this client knows about.
withRuleThis classifier with rule tried first.
classifyClassifies an error response; error may be undefined if the body wasn't an OData error.

defaults

static
static defaults(): Tm1ErrorClassifier

The rules this client knows about.

withRule

withRule(rule: Tm1ErrorClassifier.Rule): Tm1ErrorClassifier

This classifier with rule tried first.

classify

classify(status: number, error: ODataError | undefined): Tm1ErrorKind

Classifies an error response; error may be undefined if the body wasn't an OData error. The first matching rule's kind, or else the kind for the status (Other if it has none).