@SuppressWarnings("ThrowableResultOfMethodCallIgnored") public void handle(final ExceptionMessage exMsg) { EventRecord.here(getClass(), EventType.MSG_REPLY, exMsg.getPayload().getClass().getSimpleName()) .debug(); LOG.trace("Caught exception while servicing: " + exMsg.getPayload()); final Throwable exception = exMsg.getException(); if (exception instanceof MessagingException && exception.getCause() instanceof EucalyptusCloudException) { try { final EucalyptusCloudException cloudException = (EucalyptusCloudException) exception.getCause(); final BaseMessage payload = parsePayload(exMsg.getPayload()); final HttpResponseStatus status; final Role role; final String code; if (cloudException instanceof EucalyptusWebServiceException) { final EucalyptusWebServiceException webServiceException = (EucalyptusWebServiceException) cloudException; role = webServiceException.getRole(); code = webServiceException.getCode(); } else { role = Role.Receiver; code = defaultCode; } final QueryBindingInfo info = Ats.inClassHierarchy(cloudException.getClass()).get(QueryBindingInfo.class); status = info == null ? HttpResponseStatus.INTERNAL_SERVER_ERROR : new HttpResponseStatus(info.statusCode(), code); final BaseMessage errorResp = buildErrorResponse(payload.getCorrelationId(), role, code, cloudException.getMessage()); Contexts.response(new BaseMessageSupplier(errorResp, status)); } catch (final PayloadParseException e) { LOG.error("Failed to parse payload ", e.getCause()); } } else { LOG.error("Unable to handle exception", exception); final BaseMessage errorResp = buildFatalResponse(exception); Contexts.response( new BaseMessageSupplier(errorResp, HttpResponseStatus.INTERNAL_SERVER_ERROR)); } }