Record Class ODataError
java.lang.Object
java.lang.Record
io.skipcheck.tm1.client.error.ODataError
- Record Components:
code- the error code, as textmessage- the messagetarget- what the error applies to, ornulldetails- further errors, possibly emptyinnerError- service-specific detail, ornull
public record ODataError(String code, String message, @Nullable String target, List<ODataError> details, @Nullable tools.jackson.databind.JsonNode innerError)
extends Record
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.
-
Constructor Summary
ConstructorsConstructorDescriptionODataError(String code, String message, @Nullable String target, List<ODataError> details, @Nullable tools.jackson.databind.JsonNode innerError) Replaces anullcode or message with an empty string and copies the details. -
Method Summary
Modifier and TypeMethodDescriptioncode()Returns the value of thecoderecord component.details()Returns the value of thedetailsrecord component.final booleanIndicates whether some other object is "equal to" this one.static @Nullable ODataErrorfrom(@Nullable tools.jackson.databind.JsonNode body) Reads an error from a response body, if it is one: either{"error":{...}}or the inner object.static @Nullable ODataErrorReads an error from a plain-text body, as TM1 sends for some failures (impersonation, for one): a status line such asError: Bad Request, then the message.final inthashCode()Returns a hash code value for this object.@Nullable tools.jackson.databind.JsonNodeReturns the value of theinnerErrorrecord component.message()Returns the value of themessagerecord component.@Nullable Stringtarget()Returns the value of thetargetrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ODataError
public ODataError(String code, String message, @Nullable String target, List<ODataError> details, @Nullable tools.jackson.databind.JsonNode innerError) Replaces anullcode or message with an empty string and copies the details.
-
-
Method Details
-
from
Reads an error from a response body, if it is one: either{"error":{...}}or the inner object.- Parameters:
body- a response body, ornull- Returns:
- the error, or
nullif the body isn't an object with acodeormessage
-
fromText
Reads an error from a plain-text body, as TM1 sends for some failures (impersonation, for one): a status line such asError: Bad Request, then the message. The status line is dropped, and the remaining lines become the message, with no code.- Parameters:
body- the response body as text- Returns:
- the error, or
nullif the body has no message
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
code
-
message
-
target
-
details
-
innerError
public @Nullable tools.jackson.databind.JsonNode innerError()Returns the value of theinnerErrorrecord component.- Returns:
- the value of the
innerErrorrecord component
-