As the ExceptionHandler was static, it was impossible to change the configuration, like with stacktrace or not, on the fly.
This commit is contained in:
parent
594f6a0d3b
commit
6b2814d7f2
|
@ -64,8 +64,6 @@ public abstract class AbstractJaxRsProvider implements IRestfulServerDefaults {
|
||||||
|
|
||||||
private final FhirContext CTX;
|
private final FhirContext CTX;
|
||||||
|
|
||||||
/** The default exception interceptor */
|
|
||||||
private static final JaxRsExceptionInterceptor DEFAULT_EXCEPTION_HANDLER = new JaxRsExceptionInterceptor();
|
|
||||||
private static final String PROCESSING = "processing";
|
private static final String PROCESSING = "processing";
|
||||||
private static final String ERROR = "error";
|
private static final String ERROR = "error";
|
||||||
|
|
||||||
|
@ -260,13 +258,13 @@ public abstract class AbstractJaxRsProvider implements IRestfulServerDefaults {
|
||||||
public Response handleException(final JaxRsRequest theRequest, final Throwable theException)
|
public Response handleException(final JaxRsRequest theRequest, final Throwable theException)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (theException instanceof JaxRsResponseException) {
|
if (theException instanceof JaxRsResponseException) {
|
||||||
return DEFAULT_EXCEPTION_HANDLER.convertExceptionIntoResponse(theRequest, (JaxRsResponseException) theException);
|
return new JaxRsExceptionInterceptor().convertExceptionIntoResponse(theRequest, (JaxRsResponseException) theException);
|
||||||
} else if (theException instanceof DataFormatException) {
|
} else if (theException instanceof DataFormatException) {
|
||||||
return DEFAULT_EXCEPTION_HANDLER.convertExceptionIntoResponse(theRequest, new JaxRsResponseException(
|
return new JaxRsExceptionInterceptor().convertExceptionIntoResponse(theRequest, new JaxRsResponseException(
|
||||||
new InvalidRequestException(theException.getMessage(), createOutcome((DataFormatException) theException))));
|
new InvalidRequestException(theException.getMessage(), createOutcome((DataFormatException) theException))));
|
||||||
} else {
|
} else {
|
||||||
return DEFAULT_EXCEPTION_HANDLER.convertExceptionIntoResponse(theRequest,
|
return new JaxRsExceptionInterceptor().convertExceptionIntoResponse(theRequest,
|
||||||
DEFAULT_EXCEPTION_HANDLER.convertException(this, theException));
|
new JaxRsExceptionInterceptor().convertException(this, theException));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue