@Test public void testDisconnect() { final StoregateExceptionMappingService service = new StoregateExceptionMappingService(); assertEquals(ConnectionRefusedException.class, service.map( new ApiException(new ProcessingException(new SSLException(new SocketException("Operation timed out (Read failed)"))))).getClass()); }
@Override public BackgroundException map(final ApiException failure) { for(Throwable cause : ExceptionUtils.getThrowableList(failure)) { if(cause instanceof SocketException) { return new DefaultSocketExceptionMappingService().map((SocketException) cause); } if(cause instanceof HttpResponseException) { return new DefaultHttpResponseExceptionMappingService().map((HttpResponseException) cause); } if(cause instanceof IOException) { return new DefaultIOExceptionMappingService().map((IOException) cause); } if(cause instanceof IllegalStateException) { return new ConnectionCanceledException(cause); } } return new DefaultHttpResponseExceptionMappingService().map(new HttpResponseException(failure.getCode(), failure.getMessage())); }
StoregateExceptionMappingService extends AbstractExceptionMappingService<ApiException> { @Override public BackgroundException map(final ApiException failure) { for(Throwable cause : ExceptionUtils.getThrowableList(failure)) { if(cause instanceof SocketException) { return new DefaultSocketExceptionMappingService().map((SocketException) cause); } if(cause instanceof HttpResponseException) { return new DefaultHttpResponseExceptionMappingService().map((HttpResponseException) cause); } if(cause instanceof IOException) { return new DefaultIOExceptionMappingService().map((IOException) cause); } if(cause instanceof IllegalStateException) { return new ConnectionCanceledException(cause); } } return new DefaultHttpResponseExceptionMappingService().map(new HttpResponseException(failure.getCode(), failure.getMessage())); } }
StoregateExceptionMappingService extends AbstractExceptionMappingService<ApiException> { @Override public BackgroundException map(final ApiException failure) { for(Throwable cause : ExceptionUtils.getThrowableList(failure)) { if(cause instanceof SocketException) { return new DefaultSocketExceptionMappingService().map((SocketException) cause); } if(cause instanceof HttpResponseException) { return new DefaultHttpResponseExceptionMappingService().map((HttpResponseException) cause); } if(cause instanceof IOException) { return new DefaultIOExceptionMappingService().map((IOException) cause); } if(cause instanceof IllegalStateException) { return new ConnectionCanceledException(cause); } } return new DefaultHttpResponseExceptionMappingService().map(new HttpResponseException(failure.getCode(), failure.getMessage())); }  }
StoregateExceptionMappingService extends AbstractExceptionMappingService<ApiException> { @Override public BackgroundException map(final ApiException failure) { for(Throwable cause : ExceptionUtils.getThrowableList(failure)) { if(cause instanceof SocketException) { return new DefaultSocketExceptionMappingService().map((SocketException) cause); } if(cause instanceof HttpResponseException) { return new DefaultHttpResponseExceptionMappingService().map((HttpResponseException) cause); } if(cause instanceof IOException) { return new DefaultIOExceptionMappingService().map((IOException) cause); } if(cause instanceof IllegalStateException) { return new ConnectionCanceledException(cause); } } return new DefaultHttpResponseExceptionMappingService().map(new HttpResponseException(failure.getCode(), failure.getMessage())); }  @Override BackgroundException map(final ApiException failure); }
StoregateExceptionMappingService extends AbstractExceptionMappingService<ApiException> { @Override public BackgroundException map(final ApiException failure) { for(Throwable cause : ExceptionUtils.getThrowableList(failure)) { if(cause instanceof SocketException) { return new DefaultSocketExceptionMappingService().map((SocketException) cause); } if(cause instanceof HttpResponseException) { return new DefaultHttpResponseExceptionMappingService().map((HttpResponseException) cause); } if(cause instanceof IOException) { return new DefaultIOExceptionMappingService().map((IOException) cause); } if(cause instanceof IllegalStateException) { return new ConnectionCanceledException(cause); } } return new DefaultHttpResponseExceptionMappingService().map(new HttpResponseException(failure.getCode(), failure.getMessage())); }  @Override BackgroundException map(final ApiException failure);  }