@Test public void testUncheckedIOExceptionReturns502Response() throws Exception { when(request.getAction()).thenReturn(HttpMethods.GET); doThrow(new UncheckedIOException(new IOException("message"))).when(proxyFacet).get(context); assertStatusCode(underTest.handle(context), HttpStatus.BAD_GATEWAY); }
@Nonnull @Override public Response handle(@Nonnull final Context context) throws Exception { final Response response = buildMethodNotAllowedResponse(context); if (response != null) { return response; } try { Payload payload = proxyFacet(context).get(context); if (payload != null) { return buildPayloadResponse(context, payload); } return buildNotFoundResponse(context); } catch (BypassHttpErrorException e) { return buildHttpErrorResponce(e); } catch (ProxyServiceException e) { return HttpResponses.serviceUnavailable(); } catch (CooperationException e) { return HttpResponses.serviceUnavailable(e.getMessage()); } catch (IOException | UncheckedIOException e) { return HttpResponses.badGateway(); } }
ProxyHandler extends ComponentSupport implements Handler { @Nonnull @Override public Response handle(@Nonnull final Context context) throws Exception { final Response response = buildMethodNotAllowedResponse(context); if (response != null) { return response; } try { Payload payload = proxyFacet(context).get(context); if (payload != null) { return buildPayloadResponse(context, payload); } return buildNotFoundResponse(context); } catch (BypassHttpErrorException e) { return buildHttpErrorResponce(e); } catch (ProxyServiceException e) { return HttpResponses.serviceUnavailable(); } catch (CooperationException e) { return HttpResponses.serviceUnavailable(e.getMessage()); } catch (IOException | UncheckedIOException e) { return HttpResponses.badGateway(); } } }
ProxyHandler extends ComponentSupport implements Handler { @Nonnull @Override public Response handle(@Nonnull final Context context) throws Exception { final Response response = buildMethodNotAllowedResponse(context); if (response != null) { return response; } try { Payload payload = proxyFacet(context).get(context); if (payload != null) { return buildPayloadResponse(context, payload); } return buildNotFoundResponse(context); } catch (BypassHttpErrorException e) { return buildHttpErrorResponce(e); } catch (ProxyServiceException e) { return HttpResponses.serviceUnavailable(); } catch (CooperationException e) { return HttpResponses.serviceUnavailable(e.getMessage()); } catch (IOException | UncheckedIOException e) { return HttpResponses.badGateway(); } }  }
ProxyHandler extends ComponentSupport implements Handler { @Nonnull @Override public Response handle(@Nonnull final Context context) throws Exception { final Response response = buildMethodNotAllowedResponse(context); if (response != null) { return response; } try { Payload payload = proxyFacet(context).get(context); if (payload != null) { return buildPayloadResponse(context, payload); } return buildNotFoundResponse(context); } catch (BypassHttpErrorException e) { return buildHttpErrorResponce(e); } catch (ProxyServiceException e) { return HttpResponses.serviceUnavailable(); } catch (CooperationException e) { return HttpResponses.serviceUnavailable(e.getMessage()); } catch (IOException | UncheckedIOException e) { return HttpResponses.badGateway(); } }  @Nonnull @Override Response handle(@Nonnull final Context context); }
ProxyHandler extends ComponentSupport implements Handler { @Nonnull @Override public Response handle(@Nonnull final Context context) throws Exception { final Response response = buildMethodNotAllowedResponse(context); if (response != null) { return response; } try { Payload payload = proxyFacet(context).get(context); if (payload != null) { return buildPayloadResponse(context, payload); } return buildNotFoundResponse(context); } catch (BypassHttpErrorException e) { return buildHttpErrorResponce(e); } catch (ProxyServiceException e) { return HttpResponses.serviceUnavailable(); } catch (CooperationException e) { return HttpResponses.serviceUnavailable(e.getMessage()); } catch (IOException | UncheckedIOException e) { return HttpResponses.badGateway(); } }  @Nonnull @Override Response handle(@Nonnull final Context context);  }