Response Handling

Errors

In FHIR, errors can be detected and processed at two different layers - the HTTP layer and the FHIR layer. HTTP errors are returned in the HTTP response code that is part of the HTTP specification. FHIR errors and warnings are returned using the OperationOutcome resource. In some cases, both may be present. This page provides some general guidance around the types of error handling behavior client systems should expect from eReferral systems.

HTTP Status Codes

The following table lists the HTTP codes that may come back from an HTTP call, the type of circumstances when such a response might occur, whether an OperationOutcome may or must be present (and what it will contain) and the general sort of behavior that the client system should execute.

Response Code Description Notes
200 OK
204 No Content
400 Bad Request Resource could not be parsed or failed basic FHIR® validation rules (or multiple matches were found for the same request)
404 Not Found Resource type not supported, or not a FHIR end-point
405 Method Not Allowed The resource did not exist prior to the update, and the server does not allow client defined ids

Response 400 Error Codes

Code Description
CMS_ERROR_SYSTEM unexpected and untracked error
CMS_ERROR_CACHE cache operation error
CMS_ERROR_EVENT event handling error
CMS_ERROR_PARSE json string parsing error
CMS_ERROR_STRINGIFY json object stringify error
CMS_ERROR_SERIALIZE typescript object to json object serialization error
CMS_ERROR_DESERIALIZE json object to typescript object deserialization error
CMS_ERROR_CONTEXT_SYNC session context sync error
CMS_ERROR_REQUIRED_SESSION session context is required error
CMS_ERROR_REQUIRED_ORGANIZATION session context organization resource is required
CMS_ERROR_REQUIRED_PRACTITIONER session context practitioner resource is required
CMS_ERROR_INVALID_PRACTITIONER session context practitioner resource is invalid
CMS_ERROR_REQUIRED_PATIENT session context patient resource is required
CMS_ERROR_INVALID_PATIENT session context patient resource is invalid
CMS_ERROR_REQUIRED_PARAMETERS session context parameters resource is required
CMS_ERROR_REQUIRED_CONTEXT FHIRcastpublication request context array is required
CMS_ERROR_INVALID_CONTEXT FHIRcast publication request context array is invalid
CMS_ERROR_REQUIRED_PUBLICATION FHIRcast publication request is required
CMS_ERROR_INVALID_PUBLICATION FHIRcast publication request is invalid
ERROR_REQUIRED_TIMESTAMP FHIRcast publication request timestamp element is required
ERROR_REQUIRED_PUBLICATION_ID FHIRcast publication request id element is required
ERROR_REQUIRED_EVENT FHIRcast publication request event element is required
ERROR_REQUIRED_HUBTOPIC FHIRcast publication request hubtopic element is required
CMS_ERROR_REQUIRED_HUBEVENT FHIRcast publication request hubevent element is required
CMS_ERROR_INVALID_HUBEVENT FHIRcast publication request hubevent element is invalid
CMS_ERROR_REQUIRED_CONTEXT_KEY FHIRcast publication request context key element is required
CMS_ERROR_REQUIRED_CONTEXT_RESOURCE FHIRcast publication request context resource element is required
CMS_ERROR_REQUIRED_EVENT_RESOURCE FHIRcast event must have all required FHIR resources
CMS_ERROR_INVALID_EVENT_RESOURCE FHIRcast event must have only allowed FHIR resources
CMS_ERROR_REQUIRED_EVENT_PARAMETER FHIRcast event must have all required FHIR parameters
CMS_ERROR_INVALID_EVENT_PARAMETER FHIRcast event must have only allowed FHIR parameters
CMS_ERROR_INVALID_RESOURCE FHIR resource is invalid
CMS_ERROR_REQUIRED_HEADER HTTP header is required
CMS_ERROR_INVALID_HEADER HTTP header is invalid
CMS_ERROR_REQUIRED_SUB authorization header sub element is required
CMS_ERROR_REQUIRED_AZP authorization header azp element is required
CMS_ERROR_REQUIRED_UAO authorization header uao element is required
CMS_ERROR_REQUIRED_UAO_NAME authorization header uao name element is required
CMS_ERROR_REQUIRED_UAO_TYPE authorization header uao type element is required