Class ApiError

All Implemented Interfaces:
Serializable

public final class ApiError extends CryptoServiceException
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 Details

    • status

      public int status()
      The HTTP status.
      Returns:
      a status outside 2xx
    • problem

      public Problem problem()
      The RFC 9457 problem.
      Returns:
      the problem; never null on an instance the client raised