Class Tm1ErrorClassifier
java.lang.Object
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(Tm1ErrorClassifier.Rule) adds your own in front of them, e.g. for a message your TM1 version
phrases differently.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne classification rule. -
Method Summary
Modifier and TypeMethodDescriptionclassify(int status, @Nullable ODataError error) Classifies an error response;errormay be null if the body wasn't an OData error.static Tm1ErrorClassifierdefaults()The rules this client knows about.A classifier tryingrulebefore these rules.
-
Method Details
-
defaults
The rules this client knows about.- Returns:
- the default classifier
-
withRule
A classifier tryingrulebefore these rules.- Parameters:
rule- the rule to try first- Returns:
- a new classifier; this one is unchanged
-
classify
Classifies an error response;errormay be null if the body wasn't an OData error.- Parameters:
status- the HTTP statuserror- the parsed error body, ornull- Returns:
- the first matching rule's kind, or else the kind for the status
(
Tm1ErrorKind.OTHERif it has none)
-