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 static | The rules this client knows about. |
withRule | This classifier with rule tried first. |
classify | Classifies an error response; error may be undefined if the body wasn't an OData error. |
defaults
staticstatic defaults(): Tm1ErrorClassifierThe rules this client knows about.
withRule
withRule(rule: Tm1ErrorClassifier.Rule): Tm1ErrorClassifierThis classifier with rule tried first.
classify
classify(status: number, error: ODataError | undefined): Tm1ErrorKindClassifies 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).