Search in sources :

Example 1 with SerializableError

use of com.palantir.remoting2.errors.SerializableError in project atlasdb by palantir.

the class SerializableErrorDecoderTest method assertCanSerializeAndDeserializeErrorWithName.

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));
}
Also used : Response(feign.Response) SerializableError(com.palantir.remoting2.errors.SerializableError) AtlasDbRemoteException(com.palantir.atlasdb.http.errors.AtlasDbRemoteException) AtlasDbRemoteException(com.palantir.atlasdb.http.errors.AtlasDbRemoteException) IOException(java.io.IOException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Example 2 with SerializableError

use of com.palantir.remoting2.errors.SerializableError in project atlasdb by palantir.

the class ExceptionMappersTest method assertSerializedFormOfRuntimeException.

private static void assertSerializedFormOfRuntimeException(Object entity) {
    SerializableError error = (SerializableError) entity;
    assertThat(error.getErrorName()).isEqualTo(RUNTIME_EXCEPTION.getClass().getName());
    assertThat(error.getMessage()).isEqualTo(RUNTIME_EXCEPTION.getMessage());
}
Also used : SerializableError(com.palantir.remoting2.errors.SerializableError)

Aggregations

SerializableError (com.palantir.remoting2.errors.SerializableError)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 AtlasDbRemoteException (com.palantir.atlasdb.http.errors.AtlasDbRemoteException)1 Response (feign.Response)1 IOException (java.io.IOException)1