@Override
  public Throwable resolveException(final ObjectNode response) {
    log.trace("Resolving exception from JSON response {}", response);

    final JsonNode error = response.get(JsonRpcBasicServer.ERROR);
    if (error == null || !error.isObject()) {
      log.warn("No error information found in JSON response {}", response);
      return null;
    }

    final JsonNode code = error.get(JsonRpcBasicServer.ERROR_CODE);
    if (code == null || !code.isInt() || code.asInt() != ThrowableSerializationMixin.ERROR_CODE) {
      log.warn("Not resolving exception for unsupported error code {}", code);
      return null;
    }

    final JsonNode data = error.get(JsonRpcBasicServer.DATA);
    if (data == null || !data.isObject()) {
      log.warn("No error details included in data field of JSON error {}", error);
      return null;
    }

    final ObjectNode dataObject = ((ObjectNode) data);
    if (!dataObject.has(JsonRpcBasicServer.ERROR_MESSAGE)) {
      dataObject.set(
          JsonRpcBasicServer.ERROR_MESSAGE,
          new TextNode(error.get(JsonRpcBasicServer.ERROR_MESSAGE).asText()));
    }

    try {
      return mapper.treeToValue(data, Throwable.class);
    } catch (final JsonProcessingException e) {
      log.warn("Unable to convert JSON response error '{}' into Throwable", data, e);
      return null;
    }
  }
Resolves a given JSON-RPC error response into a Throwable.

<p>Callers expect this method to return null (instead of raising an exception) if it cannot
deserialize the given response object.
json-rpc-core/src/main/java/com/amazonaws/blox/jsonrpc/PojoExceptionResolver.java