@Override public BaseServerResponseException preProcessOutgoingException(RequestDetails theRequestDetails, Throwable theException, HttpServletRequest theServletRequest) throws ServletException { BaseServerResponseException retVal; if (theException instanceof DataFormatException) { // Wrapping the DataFormatException as an InvalidRequestException so that it gets sent back to the client as a 400 response. retVal = new InvalidRequestException(theException); } else if (!(theException instanceof BaseServerResponseException)) { retVal = new InternalErrorException(theException); } else { retVal = (BaseServerResponseException) theException; } if (retVal.getOperationOutcome() == null) { retVal.setOperationOutcome(createOperationOutcome(theException, theRequestDetails.getServer().getFhirContext())); } return retVal; }
exception.setOperationOutcome(oo);
public static <T extends BaseServerResponseException> T exception(Function<String, T> func, IBaseOperationOutcome operationOutcome, String msg, Object... args) { T exception = func.apply(String.format(msg, args)); exception.setOperationOutcome(operationOutcome); return exception; } }
public static <T extends BaseServerResponseException> T exception(Function<String, T> func, IBaseOperationOutcome operationOutcome, String msg, Object... args) { T exception = func.apply(String.format(msg, args)); exception.setOperationOutcome(operationOutcome); return exception; } }
@Override public BaseServerResponseException preProcessOutgoingException(RequestDetails theRequestDetails, Throwable theException, HttpServletRequest theServletRequest) throws ServletException { BaseServerResponseException retVal; if (theException instanceof DataFormatException) { // Wrapping the DataFormatException as an InvalidRequestException so that it gets sent back to the client as a 400 response. retVal = new InvalidRequestException(theException); } else if (!(theException instanceof BaseServerResponseException)) { retVal = new InternalErrorException(theException); } else { retVal = (BaseServerResponseException) theException; } if (retVal.getOperationOutcome() == null) { retVal.setOperationOutcome(createOperationOutcome(theException, theRequestDetails.getServer().getFhirContext())); } return retVal; }
exception.setOperationOutcome(oo);