HS.FHIRServer.Interop.Service returning error status code and OperationOutcome
I'm using this service to create a FHIR facade.
I want to return OperationOutcome to the calling application when I detect an error.
My code at present is :
set quickStreamOut=##class(HS.SDA3.QuickStream).%New()
set operationOutcome = ##class(HS.FHIR.DTL.vR4.Model.Resource.OperationOutcome).%New()
s issue = ##class(HS.FHIR.DTL.vR4.Model.Element.OperationOutcome.issue).%New()
s issue.severity = "error"s issue.code = "exception"s issue.details = ##class(HS.FHIR.DTL.vR4.Model.Datatype.CodeableConcept).%New()
try {
s issue.details.text = exception.DisplayString()
} catch ex {
s issue.details.text = "Unknown exception"
}
d operationOutcome.issue.Insert(issue)
$$$ThrowOnError(quickStreamOut.CopyFrom(operationOutcome.ToJSON()))
set response = ##class(HS.FHIRServer.Interop.Response).%New()
set response.Response.ResponseFormatCode="JSON"set response.Response.Status=200set response.ContentType="application/fhir+json"set response.CharSet = "utf8"set response.QuickStreamId = quickStreamOut.%Id()If I change the response code to 422, the calling app doesn't get the OperationOutcome. Instead I get
The custom error module does not recognize this error.
Do I need to implement a custom error?
Product version: HealthShare Health Connect 2025.3
Discussion (0)1