Restler icon indicating copy to clipboard operation
Restler copied to clipboard

How custom exception for FHIR

Open ander-chan opened this issue 3 years ago • 0 comments

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 &quot;name&quot; parameter has the modifier &quot;exact&quot; which is not supported by this server</p>
    </div>
  </text>
  <issue>
    <severity value="fatal"/>
    <code value="code-invalid"/>
    <details>
      <text value="The &quot;name&quot; parameter has the modifier &quot;exact&quot; 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."
  }
}

ander-chan avatar Apr 28 '22 21:04 ander-chan