skipcheck

TM1 client · Docs · Errors

Tm1ErrorClassifier

import io.skipcheck.tm1.client.error.Tm1ErrorClassifier;

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.
withRuleA classifier trying rule before these rules.
classifyClassifies an error response; error may be null if the body wasn't an OData error.

defaults

static
static Tm1ErrorClassifier defaults()

The rules this client knows about.

Returns

the default classifier

withRule

Tm1ErrorClassifier withRule(Tm1ErrorClassifier.Rule rule)

A classifier trying rule before these rules.

Parameters

rule
the rule to try first

Returns

a new classifier; this one is unchanged

classify

Tm1ErrorKind classify(int status, ODataError error)

Classifies an error response; error may be null if the body wasn't an OData error.

Parameters

status
the HTTP status
error
the parsed error body, or null

Returns

the first matching rule's kind, or else the kind for the status (Tm1ErrorKind.OTHER if it has none)

Also in the Javadoc.