fix error message suppression on tooling client

This commit is contained in:
Grahame Grieve 2020-12-03 12:46:43 +11:00
parent 2dff99e99b
commit b9664caec0
5 changed files with 24 additions and 24 deletions

View File

@ -516,7 +516,7 @@ public class FHIRToolingClient {
return p_out; return p_out;
} }
} catch (Exception e) { } catch (Exception e) {
handleException("Error performing operation '"+name+"' with parameters " + ps, e); handleException("Error performing operation '"+name+": "+e.getMessage()+"' (parameters = \"" + ps+"\")", e);
} }
return null; return null;
} }

View File

@ -517,7 +517,7 @@ public class FHIRToolingClient {
return p_out; return p_out;
} }
} catch (Exception e) { } catch (Exception e) {
handleException("Error performing operation '"+name+"' with parameters " + ps, e); handleException("Error performing operation '"+name+": "+e.getMessage()+"' (parameters = \"" + ps+"\")", e);
} }
return null; return null;
} }

View File

@ -504,7 +504,7 @@ public class FHIRToolingClient {
return p_out; return p_out;
} }
} catch (Exception e) { } catch (Exception e) {
handleException("Error performing operation '"+name+"' with parameters " + ps, e); handleException("Error performing operation '"+name+": "+e.getMessage()+"' (parameters = \"" + ps+"\")", e);
} }
return null; return null;
} }

View File

@ -507,7 +507,7 @@ public class FHIRToolingClient {
return p_out; return p_out;
} }
} catch (Exception e) { } catch (Exception e) {
handleException("Error performing operation '"+name+"' with parameters " + ps, e); handleException("Error performing operation '"+name+": "+e.getMessage()+"' (parameters = \"" + ps+"\")", e);
} }
return null; return null;
} }

View File

@ -261,28 +261,28 @@ public class FHIRToolingClient {
String ps = ""; String ps = "";
try { try {
if (!complex) if (!complex)
for (ParametersParameterComponent p : params.getParameter()) for (ParametersParameterComponent p : params.getParameter())
if (p.getValue() instanceof PrimitiveType) if (p.getValue() instanceof PrimitiveType)
ps += p.getName() + "=" + Utilities.encodeUri(((PrimitiveType) p.getValue()).asStringValue()) + "&"; ps += p.getName() + "=" + Utilities.encodeUri(((PrimitiveType) p.getValue()).asStringValue()) + "&";
ResourceRequest<T> result; ResourceRequest<T> result;
if (complex) { if (complex) {
result = client.issuePostRequest(resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps), ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), result = client.issuePostRequest(resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps), ByteUtils.resourceToByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(),
"POST " + resourceClass.getName() + "/$" + name, TIMEOUT_OPERATION_LONG); "POST " + resourceClass.getName() + "/$" + name, TIMEOUT_OPERATION_LONG);
} else { } else {
result = client.issueGetResourceRequest(resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps), getPreferredResourceFormat(), "GET " + resourceClass.getName() + "/$" + name, TIMEOUT_OPERATION_LONG); result = client.issueGetResourceRequest(resourceAddress.resolveOperationURLFromClass(resourceClass, name, ps), getPreferredResourceFormat(), "GET " + resourceClass.getName() + "/$" + name, TIMEOUT_OPERATION_LONG);
} }
if (result.isUnsuccessfulRequest()) { if (result.isUnsuccessfulRequest()) {
throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload()); throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome) result.getPayload());
} }
if (result.getPayload() instanceof Parameters) { if (result.getPayload() instanceof Parameters) {
return (Parameters) result.getPayload(); return (Parameters) result.getPayload();
} else { } else {
Parameters p_out = new Parameters(); Parameters p_out = new Parameters();
p_out.addParameter().setName("return").setResource(result.getPayload()); p_out.addParameter().setName("return").setResource(result.getPayload());
return p_out; return p_out;
} }
} catch (Exception e) { } catch (Exception e) {
handleException("Error performing operation '" + name + "' with parameters " + ps, e); handleException("Error performing operation '"+name+": "+e.getMessage()+"' (parameters = \"" + ps+"\")", e);
} }
return null; return null;
} }