Skip to content

Commit

Permalink
Merge pull request #2650 from FirelyTeam/bugfix/2631-fix-localtermino…
Browse files Browse the repository at this point in the history
…logy-system-exceptions

LocalTerminologyService returns original FhirOperationException from getExpandedValueSet
  • Loading branch information
mmsmits authored Jan 4, 2024
2 parents 2fcb466 + b3a8990 commit 4fa8588
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ private async Task<ValueSet> getExpandedValueSet(ValueSet vs, string operation)
}
}
catch (TerminologyServiceException e)
#pragma warning restore CS0618
{
// Unprocessable entity
throw new FhirOperationException(
Expand Down Expand Up @@ -176,7 +175,7 @@ public async T.Task<Parameters> ValueSetValidateCode(Parameters parameters, stri
else
return await validateCodeVS(valueSet, validateCodeParams.Code?.Value, validateCodeParams.System?.Value, validateCodeParams.Display?.Value, validateCodeParams.Abstract?.Value).ConfigureAwait(false);
}
catch (Exception e)
catch (Exception e) when (e is not FhirOperationException)
{
//500 internal server error
throw new FhirOperationException(e.Message, (HttpStatusCode)500);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ public async void LocalTermServiceValidateCodeWithParamsTest()
inParams = new ValidateCodeParameters()
.WithValueSet(url: "http://hl7.org/fhir/ValueSet/substance-code")
.WithCode(code: "1166006", system: "http://snomed.info/sct");
await Assert.ThrowsAsync<FhirOperationException>(async () => await svc.ValueSetValidateCode(inParams));

var exception = await Assert.ThrowsAsync<FhirOperationException>(async () => await svc.ValueSetValidateCode(inParams));
Assert.Equal(System.Net.HttpStatusCode.UnprocessableEntity, exception.Status);
}

[Fact]
Expand All @@ -332,8 +332,8 @@ public async T.Task LocalTermServiceValidateCodeWithoutSystemOrContext()
}
};

await Assert.ThrowsAsync<FhirOperationException>(async () => await svc.ValueSetValidateCode(inParams));

var exception = await Assert.ThrowsAsync<FhirOperationException>(async () => await svc.ValueSetValidateCode(inParams));
Assert.Equal(System.Net.HttpStatusCode.UnprocessableEntity, exception.Status);
}


Expand Down Expand Up @@ -363,7 +363,8 @@ public async T.Task LocalTermServiceUsingDuplicateParameters()
}
};

await Assert.ThrowsAsync<FhirOperationException>(async () => await svc.ValueSetValidateCode(inParams));
var exception = await Assert.ThrowsAsync<FhirOperationException>(async () => await svc.ValueSetValidateCode(inParams));
Assert.Equal(System.Net.HttpStatusCode.UnprocessableEntity, exception.Status);
}

[Fact]
Expand Down

0 comments on commit 4fa8588

Please sign in to comment.