Wrap NPM loader in a try-catch

This commit is contained in:
jamesagnew 2020-07-21 09:57:10 -04:00
parent 4c4d46008b
commit c44c1ff11f
1 changed files with 16 additions and 11 deletions

View File

@ -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.TokenParam;
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.util.FhirTerser;
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.
*/
private void createOrUpdate(IBaseResource resource) {
try {
IFhirResourceDao dao = myDaoRegistry.getResourceDao(resource.getClass());
IBundleProvider searchResult = dao.search(createSearchParameterMapFor(resource));
if (searchResult.isEmpty()) {
@ -297,6 +299,9 @@ public class PackageInstallerSvcImpl implements IPackageInstallerSvc {
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) {