Skip to content

Commit 71cd87e

Browse files
authored
handle exception better (#20)
## Summary - Routine Change ### Details - handles exceptions better
1 parent 016baf4 commit 71cd87e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/main/java/software/nhs/FHIRValidator/HandlerStream.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ public void handleRequest(InputStream inputStream, OutputStream outputStream, Co
5050
writer.close();
5151
}
5252

53-
} catch (IOException e) {
54-
// TODO Auto-generated catch block
55-
e.printStackTrace();
53+
} catch (IOException ex) {
54+
log.error(ex.getMessage(), ex);
55+
throw new RuntimeException("error in handleRequest", ex);
5656
}
5757
}
5858
}

src/main/java/software/nhs/FHIRValidator/Validator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import ca.uhn.fhir.context.support.DefaultProfileValidationSupport;
2525
import ca.uhn.fhir.context.support.IValidationSupport;
2626
import ca.uhn.fhir.context.support.ValidationSupportContext;
27+
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
2728
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
2829
import ca.uhn.fhir.validation.FhirValidator;
2930
import ca.uhn.fhir.validation.ValidationResult;
@@ -62,9 +63,9 @@ public Validator() {
6263
individualPackage.version);
6364
npmPackageSupport.loadPackageFromClasspath(packagePath);
6465
}
65-
} catch (IOException e) {
66-
// TODO Auto-generated catch block
67-
e.printStackTrace();
66+
} catch (InternalErrorException | IOException ex) {
67+
log.error(ex.getMessage(), ex);
68+
throw new RuntimeException("error loading simplifier packages", ex);
6869
}
6970
supportChain.addValidationSupport(npmPackageSupport);
7071
generateSnapshots(supportChain);

0 commit comments

Comments
 (0)