Skip to content

Commit

Permalink
Issue #2162 - updates to how we handle UnsupportOperationException (#…
Browse files Browse the repository at this point in the history
…2238)

Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
  • Loading branch information
JohnTimm authored Apr 12, 2021
1 parent 4af75c8 commit d9e8bd5
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ public static OperationOutcome.Issue buildOperationOutcomeIssue(IssueSeverity se

public static OperationOutcome.Issue buildOperationOutcomeIssue(IssueSeverity severity, IssueType code, String details,
String expression) {
if (details == null || details.isEmpty()) {
details = "<no details>";
}
if (expression == null || expression.isEmpty()) {
expression = "<no expression>";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ public void addProvider(FHIRTermServiceProvider provider) {
providers.add(provider);
}

/**
* Get a set containing {@link CodeSystem.Concept} instances where all structural
* hierarchies have been flattened.
*
* @param codeSystem
* the code system
* @param code
* the root of the hierarchy containing the Concept instances to be flattened
* @return
* flattened set of Concept instances for the given tree
*/
public Set<Concept> closure(CodeSystem codeSystem, Code code) {
return findProvider(codeSystem).closure(codeSystem, code);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ protected Parameters doInvoke(
throw e;
} catch (FHIRTermServiceException e) {
throw new FHIROperationException(e.getMessage(), e.getCause()).withIssue(e.getIssues());
} catch (UnsupportedOperationException e) {
throw buildExceptionWithIssue(e.getMessage(), IssueType.NOT_SUPPORTED, e);
} catch (Exception e) {
throw new FHIROperationException("An error occurred during the ConceptMap closure operation", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ protected Parameters doInvoke(
throw e;
} catch (FHIRTermServiceException e) {
throw new FHIROperationException(e.getMessage(), e.getCause()).withIssue(e.getIssues());
} catch (UnsupportedOperationException e) {
throw buildExceptionWithIssue(e.getMessage(), IssueType.NOT_SUPPORTED, e);
} catch (Exception e) {
throw new FHIROperationException("An error occurred during the CodeSystem validate code operation", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ protected Parameters doInvoke(
throw e;
} catch (FHIRTermServiceException e) {
throw new FHIROperationException(e.getMessage(), e.getCause()).withIssue(e.getIssues());
} catch (UnsupportedOperationException e) {
throw buildExceptionWithIssue(e.getMessage(), IssueType.NOT_SUPPORTED, e);
} catch (Exception e) {
throw new FHIROperationException("An error occurred during the ValueSet expand operation", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ protected Parameters doInvoke(
outcome = service.lookup(coding, LookupParameters.from(parameters));
} catch (FHIRTermServiceException e) {
throw new FHIROperationException(e.getMessage(), e.getCause()).withIssue(e.getIssues());
} catch (UnsupportedOperationException e) {
throw buildExceptionWithIssue(e.getMessage(), IssueType.NOT_SUPPORTED, e);
} catch(Exception e) {
throw new FHIROperationException("An error occurred during the CodeSystem lookup operation", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ protected Parameters doInvoke(
throw e;
} catch (FHIRTermServiceException e) {
throw new FHIROperationException(e.getMessage(), e.getCause()).withIssue(e.getIssues());
} catch (UnsupportedOperationException e) {
throw buildExceptionWithIssue(e.getMessage(), IssueType.NOT_SUPPORTED, e);
} catch (Exception e) {
throw new FHIROperationException("An error occurred during the CodeSystem subsumes operation", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.ibm.fhir.model.type.CodeableConcept;
import com.ibm.fhir.model.type.Coding;
import com.ibm.fhir.model.type.Element;
import com.ibm.fhir.model.type.code.IssueType;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
Expand Down Expand Up @@ -46,6 +47,8 @@ protected Parameters doInvoke(
throw e;
} catch (FHIRTermServiceException e) {
throw new FHIROperationException(e.getMessage(), e.getCause()).withIssue(e.getIssues());
} catch (UnsupportedOperationException e) {
throw buildExceptionWithIssue(e.getMessage(), IssueType.NOT_SUPPORTED, e);
} catch (Exception e) {
throw new FHIROperationException("An error occurred during the ConceptMap translate operation", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.ibm.fhir.model.type.CodeableConcept;
import com.ibm.fhir.model.type.Coding;
import com.ibm.fhir.model.type.Element;
import com.ibm.fhir.model.type.code.IssueType;
import com.ibm.fhir.registry.FHIRRegistry;
import com.ibm.fhir.server.operation.spi.FHIROperationContext;
import com.ibm.fhir.server.operation.spi.FHIRResourceHelpers;
Expand Down Expand Up @@ -46,6 +47,8 @@ protected Parameters doInvoke(
throw e;
} catch (FHIRTermServiceException e) {
throw new FHIROperationException(e.getMessage(), e.getCause()).withIssue(e.getIssues());
} catch (UnsupportedOperationException e) {
throw buildExceptionWithIssue(e.getMessage(), IssueType.NOT_SUPPORTED, e);
} catch (Exception e) {
throw new FHIROperationException("An error occurred during the ValueSet validate code operation", e);
}
Expand Down

0 comments on commit d9e8bd5

Please sign in to comment.