@Test public void should_honor_constructor_params() { //given String message = UUID.randomUUID().toString(); Throwable cause = new Exception("kaboom"); //when UnexpectedMajorErrorHandlingError ex = new UnexpectedMajorErrorHandlingError(message, cause); //then assertThat(ex.getMessage(), is(message)); assertThat(ex.getCause(), is(cause)); }
@Override public ErrorResponseInfo maybeHandleError(Throwable error, RequestInfo<?> requestInfo) throws UnexpectedMajorErrorHandlingError { try { com.nike.backstopper.handler.ErrorResponseInfo<ErrorResponseBody> backstopperErrorResponseInfo = maybeHandleException(error, new RequestInfoForLoggingRiposteAdapter(requestInfo)); if (backstopperErrorResponseInfo == null) return null; return new ErrorResponseInfoImpl(backstopperErrorResponseInfo); } catch (UnexpectedMajorExceptionHandlingError ex) { throw new UnexpectedMajorErrorHandlingError("Wrapping the actual cause", ex); } }