Package co.cryptoservice.sdk
Record Class Problem
java.lang.Object
java.lang.Record
co.cryptoservice.sdk.Problem
- Record Components:
type-urn:crypto-service:problem:<slug>, orabout:blankwhen the server sent no problem bodytitle- a short summary of the problem typestatus- the HTTP statusdetail- an explanation of this occurrenceinstance- the request path, or nullcode- the machine-readable code for crypto-lib, key-store and KMS errors (for exampleAUTH_FAILED,KEY_NOT_FOUND), or nullerrors- each field that failed validation (validation-failed); empty otherwiseextensions- every other member (for examplelimitandresetSecondson a tenant quota problem), in the order sent
public record Problem(String type, String title, int status, String detail, String instance, String code, List<ValidationError> errors, Map<String,com.fasterxml.jackson.databind.JsonNode> extensions)
extends Record
An RFC 9457 problem: the body of every error the server sends (
application/problem+json).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThetypeof a problem the client made up for a body that was not one. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Problemblank(int status) The problem the client uses when the body is not one.code()Returns the value of thecoderecord component.detail()Returns the value of thedetailrecord component.final booleanIndicates whether some other object is "equal to" this one.errors()Returns the value of theerrorsrecord component.Returns the value of theextensionsrecord component.final inthashCode()Returns a hash code value for this object.instance()Returns the value of theinstancerecord component.static Problemparse(byte[] body, int status) Reads a problem from an error response body.intstatus()Returns the value of thestatusrecord component.title()Returns the value of thetitlerecord component.toString()Names the type, status, code and instance, counts the validation errors and names the extension members;detailand the validation messages are left out, as they describe the request.type()Returns the value of thetyperecord component.
-
Field Details
-
ABOUT_BLANK
Thetypeof a problem the client made up for a body that was not one.- See Also:
-
-
Constructor Details
-
Problem
public Problem(String type, String title, int status, String detail, String instance, String code, List<ValidationError> errors, Map<String, com.fasterxml.jackson.databind.JsonNode> extensions) Copies the lists and maps so the problem is immutable.- Throws:
NullPointerException- whenerrorsorextensionsis null
-
-
Method Details
-
parse
Reads a problem from an error response body. A body that is not a JSON object with a stringdetail(the test the TypeScript SDK applies) becomes anabout:blankproblem forstatus.- Parameters:
body- the response bodystatus- the response status- Returns:
- the problem; never null, and never throws
-
blank
The problem the client uses when the body is not one.- Parameters:
status- the response status- Returns:
- an
about:blankproblem
-
toString
Names the type, status, code and instance, counts the validation errors and names the extension members;detailand the validation messages are left out, as they describe the request. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
title
Returns the value of thetitlerecord component.- Returns:
- the value of the
titlerecord component
-
status
public int status()Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
detail
Returns the value of thedetailrecord component.- Returns:
- the value of the
detailrecord component
-
instance
Returns the value of theinstancerecord component.- Returns:
- the value of the
instancerecord component
-
code
Returns the value of thecoderecord component.- Returns:
- the value of the
coderecord component
-
errors
Returns the value of theerrorsrecord component.- Returns:
- the value of the
errorsrecord component
-
extensions
Returns the value of theextensionsrecord component.- Returns:
- the value of the
extensionsrecord component
-