From a2ab3f55733b6e9d6a78276bd3883c4a66af9fb0 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 23 Mar 2021 19:49:06 -0400 Subject: [PATCH] rethrow dataformatexception in case of TargetInvocationException --- .../ca/uhn/fhir/rest/server/method/BaseMethodBinding.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseMethodBinding.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseMethodBinding.java index 611ba8ab0aa..f89ccc8025a 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseMethodBinding.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseMethodBinding.java @@ -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 { 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);