improve match error (#6260)
* improve error message * improve error message * fix tests
This commit is contained in:
parent
161a89db0e
commit
1e2d8b123e
|
@ -91,7 +91,7 @@ ca.uhn.fhir.jpa.dao.BaseHapiFhirDao.incomingNoopInTransaction=Transaction contai
|
||||||
ca.uhn.fhir.jpa.dao.BaseHapiFhirDao.invalidMatchUrlInvalidResourceType=Invalid match URL "{0}" - Unknown resource type: "{1}"
|
ca.uhn.fhir.jpa.dao.BaseHapiFhirDao.invalidMatchUrlInvalidResourceType=Invalid match URL "{0}" - Unknown resource type: "{1}"
|
||||||
ca.uhn.fhir.jpa.dao.BaseStorageDao.invalidMatchUrlNoMatches=Invalid match URL "{0}" - No resources match this search
|
ca.uhn.fhir.jpa.dao.BaseStorageDao.invalidMatchUrlNoMatches=Invalid match URL "{0}" - No resources match this search
|
||||||
ca.uhn.fhir.jpa.dao.BaseStorageDao.inlineMatchNotSupported=Inline match URLs are not supported on this server. Cannot process reference: "{0}"
|
ca.uhn.fhir.jpa.dao.BaseStorageDao.inlineMatchNotSupported=Inline match URLs are not supported on this server. Cannot process reference: "{0}"
|
||||||
ca.uhn.fhir.jpa.dao.BaseStorageDao.transactionOperationWithMultipleMatchFailure=Failed to {0} resource with match URL "{1}" because this search matched {2} resources
|
ca.uhn.fhir.jpa.dao.BaseStorageDao.transactionOperationWithMultipleMatchFailure=Failed to {0} {1} with match URL "{2}" because this search matched {3} resources
|
||||||
ca.uhn.fhir.jpa.dao.BaseStorageDao.deleteByUrlThresholdExceeded=Failed to DELETE resources with match URL "{0}" because the resolved number of resources: {1} exceeds the threshold of {2}
|
ca.uhn.fhir.jpa.dao.BaseStorageDao.deleteByUrlThresholdExceeded=Failed to DELETE resources with match URL "{0}" because the resolved number of resources: {1} exceeds the threshold of {2}
|
||||||
ca.uhn.fhir.jpa.dao.BaseStorageDao.transactionOperationWithIdNotMatchFailure=Failed to {0} resource with match URL "{1}" because the matching resource does not match the provided ID
|
ca.uhn.fhir.jpa.dao.BaseStorageDao.transactionOperationWithIdNotMatchFailure=Failed to {0} resource with match URL "{1}" because the matching resource does not match the provided ID
|
||||||
ca.uhn.fhir.jpa.dao.BaseTransactionProcessor.multiplePartitionAccesses=Can not process transaction with {0} entries: Entries require access to multiple/conflicting partitions
|
ca.uhn.fhir.jpa.dao.BaseTransactionProcessor.multiplePartitionAccesses=Can not process transaction with {0} entries: Entries require access to multiple/conflicting partitions
|
||||||
|
|
|
@ -420,6 +420,7 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
||||||
BaseStorageDao.class,
|
BaseStorageDao.class,
|
||||||
"transactionOperationWithMultipleMatchFailure",
|
"transactionOperationWithMultipleMatchFailure",
|
||||||
"CREATE",
|
"CREATE",
|
||||||
|
myResourceName,
|
||||||
theMatchUrl,
|
theMatchUrl,
|
||||||
match.size());
|
match.size());
|
||||||
throw new PreconditionFailedException(Msg.code(958) + msg);
|
throw new PreconditionFailedException(Msg.code(958) + msg);
|
||||||
|
@ -861,6 +862,7 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
||||||
BaseStorageDao.class,
|
BaseStorageDao.class,
|
||||||
"transactionOperationWithMultipleMatchFailure",
|
"transactionOperationWithMultipleMatchFailure",
|
||||||
"DELETE",
|
"DELETE",
|
||||||
|
myResourceName,
|
||||||
theUrl,
|
theUrl,
|
||||||
resourceIds.size()));
|
resourceIds.size()));
|
||||||
}
|
}
|
||||||
|
@ -2335,6 +2337,7 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
||||||
BaseStorageDao.class,
|
BaseStorageDao.class,
|
||||||
"transactionOperationWithMultipleMatchFailure",
|
"transactionOperationWithMultipleMatchFailure",
|
||||||
"UPDATE",
|
"UPDATE",
|
||||||
|
myResourceName,
|
||||||
theMatchUrl,
|
theMatchUrl,
|
||||||
match.size());
|
match.size());
|
||||||
throw new PreconditionFailedException(Msg.code(988) + msg);
|
throw new PreconditionFailedException(Msg.code(988) + msg);
|
||||||
|
|
|
@ -761,7 +761,7 @@ public class FhirSystemDaoDstu2Test extends BaseJpaDstu2SystemTest {
|
||||||
mySystemDao.transaction(mySrd, request);
|
mySystemDao.transaction(mySrd, request);
|
||||||
fail("");
|
fail("");
|
||||||
} catch (PreconditionFailedException e) {
|
} catch (PreconditionFailedException e) {
|
||||||
assertThat(e.getMessage()).contains("resource with match URL \"Patient?");
|
assertThat(e.getMessage()).contains("Patient with match URL \"Patient?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -641,7 +641,7 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test {
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
fail("");
|
fail("");
|
||||||
} catch (PreconditionFailedException e) {
|
} catch (PreconditionFailedException e) {
|
||||||
assertEquals("HTTP 412 Precondition Failed: " + Msg.code(962) + "Failed to DELETE resource with match URL \"Patient?identifier=testDeleteConditionalMultiple\" because this search matched 2 resources", e.getMessage());
|
assertEquals("HTTP 412 Precondition Failed: " + Msg.code(962) + "Failed to DELETE Patient with match URL \"Patient?identifier=testDeleteConditionalMultiple\" because this search matched 2 resources", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not deleted yet..
|
// Not deleted yet..
|
||||||
|
|
|
@ -1357,7 +1357,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
||||||
mySystemDao.transaction(mySrd, request);
|
mySystemDao.transaction(mySrd, request);
|
||||||
fail("");
|
fail("");
|
||||||
} catch (PreconditionFailedException e) {
|
} catch (PreconditionFailedException e) {
|
||||||
assertThat(e.getMessage()).contains("resource with match URL \"Patient?");
|
assertThat(e.getMessage()).contains("Patient with match URL \"Patient?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1083,7 +1083,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
fail("");
|
fail("");
|
||||||
} catch (PreconditionFailedException e) {
|
} catch (PreconditionFailedException e) {
|
||||||
assertEquals("HTTP 412 Precondition Failed: " + Msg.code(962) + "Failed to DELETE resource with match URL \"Patient?identifier=testDeleteConditionalMultiple&_format=json\" because this search matched 2 resources", e.getMessage());
|
assertEquals("HTTP 412 Precondition Failed: " + Msg.code(962) + "Failed to DELETE Patient with match URL \"Patient?identifier=testDeleteConditionalMultiple&_format=json\" because this search matched 2 resources", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not deleted yet..
|
// Not deleted yet..
|
||||||
|
|
|
@ -2548,7 +2548,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
|
||||||
mySystemDao.transaction(mySrd, request);
|
mySystemDao.transaction(mySrd, request);
|
||||||
fail();
|
fail();
|
||||||
} catch (PreconditionFailedException e) {
|
} catch (PreconditionFailedException e) {
|
||||||
assertThat(e.getMessage()).contains("resource with match URL \"Patient?");
|
assertThat(e.getMessage()).contains("Patient with match URL \"Patient?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -529,7 +529,7 @@ public class PatchProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
assertEquals(412, response.getStatusLine().getStatusCode());
|
assertEquals(412, response.getStatusLine().getStatusCode());
|
||||||
String responseString = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
|
String responseString = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
|
||||||
assertThat(responseString).contains("<OperationOutcome");
|
assertThat(responseString).contains("<OperationOutcome");
|
||||||
assertThat(responseString).contains("Failed to PATCH resource with match URL "Patient?active=true" because this search matched 2 resources");
|
assertThat(responseString).contains("Failed to PATCH Patient with match URL "Patient?active=true" because this search matched 2 resources");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1724,7 +1724,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
fail();
|
fail();
|
||||||
} catch (PreconditionFailedException e) {
|
} catch (PreconditionFailedException e) {
|
||||||
assertEquals("HTTP 412 Precondition Failed: " + Msg.code(962) + "Failed to DELETE resource with match URL \"Patient?identifier=testDeleteConditionalMultiple\" because this search matched 2 resources", e.getMessage());
|
assertEquals("HTTP 412 Precondition Failed: " + Msg.code(962) + "Failed to DELETE Patient with match URL \"Patient?identifier=testDeleteConditionalMultiple\" because this search matched 2 resources", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not deleted yet..
|
// Not deleted yet..
|
||||||
|
|
|
@ -122,6 +122,7 @@ public abstract class BaseStorageResourceDao<T extends IBaseResource> extends Ba
|
||||||
BaseStorageDao.class,
|
BaseStorageDao.class,
|
||||||
"transactionOperationWithMultipleMatchFailure",
|
"transactionOperationWithMultipleMatchFailure",
|
||||||
"PATCH",
|
"PATCH",
|
||||||
|
getResourceName(),
|
||||||
theConditionalUrl,
|
theConditionalUrl,
|
||||||
match.size());
|
match.size());
|
||||||
throw new PreconditionFailedException(Msg.code(972) + msg);
|
throw new PreconditionFailedException(Msg.code(972) + msg);
|
||||||
|
|
Loading…
Reference in New Issue