Package co.cryptoservice.sdk
Class ApiError
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
co.cryptoservice.sdk.CryptoServiceException
co.cryptoservice.sdk.ApiError
- All Implemented Interfaces:
Serializable
The server answered with a status outside 2xx.
problem() is the RFC 9457 problem the server sent. A body that is not a
problem (an HTML page from a proxy, an empty body, a redirect the client refused to follow)
becomes an about:blank problem for the status, so the problem always has the same shape.
try {
client.sign(new SignRequest("k_AAAAAAAAAAAAAAAAAAAAAA", "x"));
} catch (ApiError e) {
System.err.println(e.status() + " " + e.problem().type() + " " + e.problem().code());
}
The name follows the error model all the Crypto Service SDKs share; it is an unchecked
exception, not a Error.
- See Also:
-
Method Summary
Methods inherited from class co.cryptoservice.sdk.CryptoServiceException
method, pathMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Method Details
-
status
public int status()The HTTP status.- Returns:
- a status outside 2xx
-
problem
The RFC 9457 problem.- Returns:
- the problem; never null on an instance the client raised
-