Restler
Restler copied to clipboard
How custom exception for FHIR
Regards!. In the FHIR is a standard the output is represented by "OperationOutcome's" and the errors, the same eg:.
{
"resourceType": "OperationOutcome",
"meta": {
"profile": ["https://fhir.nhs.uk/STU3/StructureDefinition/GPConnect-OperationOutcome-1"]
},
"issue": [{
"severity": "error",
"code": "not-found",
"details": {
"coding": [{
"system": "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1",
"code": "PATIENT_NOT_FOUND",
"display": "Patient not found"
}]
}
}]
}
<?xml version="1.0" encoding="UTF-8"?><OperationOutcome xmlns="http://hl7.org/fhir">
<id value="searchfail"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<p>The "name" parameter has the modifier "exact" which is not supported by this server</p>
</div>
</text>
<issue>
<severity value="fatal"/>
<code value="code-invalid"/>
<details>
<text value="The "name" parameter has the modifier "exact" which is not supported by this server"/>
</details>
<location value="http.name:exact"/>
</issue>
</OperationOutcome>
I'm thinking extends RestExeption... How custom the actual output exception?
{
"error": {
"code": 400,
"message": "Bad Request: `login` is required."
}
}