Skip to content

How custom exception for FHIR #681

@ander-chan

Description

@ander-chan

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."
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions