rethrow dataformatexception in case of TargetInvocationException

This commit is contained in:
Tadgh 2021-03-23 19:49:06 -04:00
parent 6f669f9ccd
commit a2ab3f5573
1 changed files with 4 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.parser.DataFormatException;
import ca.uhn.fhir.rest.annotation.*;
import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
@ -251,6 +252,9 @@ public abstract class BaseMethodBinding<T> {
if (e.getCause() instanceof BaseServerResponseException) {
throw (BaseServerResponseException) e.getCause();
}
if (e.getTargetException() instanceof DataFormatException) {
throw (DataFormatException)e.getTargetException();
}
throw new InternalErrorException("Failed to call access method: " + e.getCause(), e);
} catch (Exception e) {
throw new InternalErrorException("Failed to call access method: " + e.getCause(), e);