mirror of
https://github.com/hapifhir/hapi-fhir.git
synced 2025-02-18 10:55:22 +00:00
Wrap NPM loader in a try-catch
This commit is contained in:
parent
4c4d46008b
commit
c44c1ff11f
@ -31,6 +31,7 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
|||||||
import ca.uhn.fhir.rest.param.StringParam;
|
import ca.uhn.fhir.rest.param.StringParam;
|
||||||
import ca.uhn.fhir.rest.param.TokenParam;
|
import ca.uhn.fhir.rest.param.TokenParam;
|
||||||
import ca.uhn.fhir.rest.param.UriParam;
|
import ca.uhn.fhir.rest.param.UriParam;
|
||||||
|
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
import ca.uhn.fhir.util.FhirTerser;
|
import ca.uhn.fhir.util.FhirTerser;
|
||||||
import ca.uhn.fhir.util.SearchParameterUtil;
|
import ca.uhn.fhir.util.SearchParameterUtil;
|
||||||
@ -282,6 +283,7 @@ public class PackageInstallerSvcImpl implements IPackageInstallerSvc {
|
|||||||
* Create a resource or update it, if its already existing.
|
* Create a resource or update it, if its already existing.
|
||||||
*/
|
*/
|
||||||
private void createOrUpdate(IBaseResource resource) {
|
private void createOrUpdate(IBaseResource resource) {
|
||||||
|
try {
|
||||||
IFhirResourceDao dao = myDaoRegistry.getResourceDao(resource.getClass());
|
IFhirResourceDao dao = myDaoRegistry.getResourceDao(resource.getClass());
|
||||||
IBundleProvider searchResult = dao.search(createSearchParameterMapFor(resource));
|
IBundleProvider searchResult = dao.search(createSearchParameterMapFor(resource));
|
||||||
if (searchResult.isEmpty()) {
|
if (searchResult.isEmpty()) {
|
||||||
@ -297,6 +299,9 @@ public class PackageInstallerSvcImpl implements IPackageInstallerSvc {
|
|||||||
dao.update(resource);
|
dao.update(resource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (BaseServerResponseException e) {
|
||||||
|
ourLog.warn("Failed to upload resource of type {} with ID {} - Error: {}", myFhirContext.getResourceType(resource), resource.getIdElement().getValue(), e.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean validForUpload(IBaseResource theResource) {
|
boolean validForUpload(IBaseResource theResource) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user