/** * Returns an AtlasDbRemoteException if the response may be decoded as such; otherwise returns a * generic RuntimeException (for instance, if the response is empty or malformed). */ @Override public Exception decode(String methodKey, Response response) { return wrapRemoteException(SerializableErrorToExceptionConverter.getException( HeaderAccessUtils.shortcircuitingCaseInsensitiveGet(response.headers(), HttpHeaders.CONTENT_TYPE), response.status(), response.reason(), getBody(response))); }
private void assertCanDecodeRuntimeException(Response response) { Exception exception = decoder.decode(SOME_METHOD_KEY, response); assertThat(exception).isInstanceOf(RuntimeException.class); } }
/** * Returns an AtlasDbRemoteException if the response may be decoded as such; otherwise returns a * generic RuntimeException (for instance, if the response is empty or malformed). */ @Override public Exception decode(String methodKey, Response response) { return wrapRemoteException(SerializableErrorToExceptionConverter.getException( HeaderAccessUtils.shortcircuitingCaseInsensitiveGet(response.headers(), HttpHeaders.CONTENT_TYPE), response.status(), response.reason(), getBody(response))); }
private void assertCanSerializeAndDeserializeErrorWithName(String errorName) throws JsonProcessingException { SerializableError serializableError = SerializableError.of(EXCEPTION_MESSAGE, errorName); Response response = createResponseForEntity(serializableError); Exception exception = decoder.decode(SOME_METHOD_KEY, response); assertThat(exception).isInstanceOf(AtlasDbRemoteException.class) .satisfies(remoteException -> assertHasErrorName(remoteException, errorName)); }