Error Handling
FHIR uses a RESTful interface and implements the following protocol for error handling:
Networking/ Communication Level Errors
Networks may detect issues during the initial processing of a message before the message reaches the application. If the error is due to issues with authorization, a bad URL or no communicaton with the network, this should generate an HTTP error. Errors will be conveyed using an HTTP 4xx or 5xx, with an optional FHIR "Operation Outcome" resource to return more detailed information. Many of these errors are generated by the generic server framework.
Some common HTTP Status codes are:
- 400 Bad Request - resource could not be parsed or failed basic FHIR validation rules (or multiple matches were found for conditional criteria)
- 401 Unauthorized - authorization is required for the interaction that was attempted
- 404 Not Found - resource type not supported, or not a FHIR end-point
Application Level Errors - Technical Issues
These types of errors occur when the request reaches the pre-processor or the application and technical issues prevent the request from being processes. Examples are validation errors, such as missing information. An Operation Outcome may be used to describe the issue, rather than returning a full response. FHIR allows a bundle to be returned with a message header and Operation Outcome.
Business Level Errors
If the request is successfully processed but business level errors are found,eg Provider not recognized, the receiving application may return a claim response, denying the claim and providing a response code to indicate the error. Generally, business errors can often be resolved by correcting the error and re-submitting. These errors may be returned as response codes.
Summary
| Request | Error Response | FHIR Resource |
|---|---|---|
| Networking Issues | HTTP 4xx or 5xx | |
| Techincal - Validation/Structural issues | HTTP 4xx | Bundle, MH.Response with Operations Outcome |
| Application Level errors | HTTP 4xx | Bundle, MH, Operations Outcome |
| Claim Response - Business Issues | HTTP 200 | Bundle, MH and Claim Response or ParametersOUT Response including "response codes" indicating errors |
Operations Outcome Profile
This will be a standard profile used across all FHIR messages that includes the following:
| FHIR Data Element | Notes |
|---|---|
| Status | value= Error |
| Code | Error code |
| Details | text |