From 511ff036570ba0b79afaf2eacfc9586715acf348 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Wed, 2 Oct 2019 14:50:44 +1000 Subject: [PATCH] better error message when terminology server not available --- .../hl7/fhir/r5/context/SimpleWorkerContext.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java index 64894d04a..afc63a6e1 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java @@ -217,12 +217,16 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon } - public String connectToTSServer(TerminologyClient client, String log) throws URISyntaxException, FHIRException { - tlog("Connect to "+client.getAddress()); - txClient = client; - txLog = new HTMLClientLogger(log); - txClient.setLogger(txLog); - return txClient.getCapabilitiesStatementQuick().getSoftware().getVersion(); + public String connectToTSServer(TerminologyClient client, String log) { + try { + tlog("Connect to "+client.getAddress()); + txClient = client; + txLog = new HTMLClientLogger(log); + txClient.setLogger(txLog); + return txClient.getCapabilitiesStatementQuick().getSoftware().getVersion(); + } catch (Exception e) { + throw new FHIRException("Unable to connect to terminology server. Use parameter '-tx n/a' tun run without using terminology services to validate LOINC, SNOMED, ICD-X etc. Error = "+e.getMessage(), e); + } } public void loadFromFile(InputStream stream, String name, IContextResourceLoader loader) throws IOException, FHIRException {