Error Handling
In the event that the API returns an error, the response body will contain a error message and error code in the JSON format shown below.
We're also sending all error codes in the response header nhn-error-code
.
You can use this header if you're only interested in the error code to avoid parsing the response body.
When error response the HTTP status will be in the range 3xx-5xx. When ok response the HTTP status will be in the 2xx range.
Example of a error response body returned from the API:
{
"errorCode": "DHG-0009",
"errorMessage": "An active maternity record already exists for patient. Cannot have multiple active maternity records.",
"eventId": "c65f8f64-2c9c-4624-a4f0-3dbc4bde3300"
}
Error Codes
Error codes has prefix "DHG".
For errors related to authorization go here.
Error code | Cause |
---|---|
DHG-0001 | Unknown technical error |
DHG-0002 | Patient is deceased, creating / updating DHG data is not allowed |
DHG-0003 | Patient has not consented to DHG - cannot read / create / update DHG |
DHG-0004 | Patient has confidential address, reading / creating / updating DHG data is not allowed |
DHG-0005 | Invalid auth role |
DHG-0006 | Techical error with DB |
DHG-0007 | Resource does not exist to update |
DHG-0008 | Invalid version sent in update request. Only newest version of a resource can be updated. Make sure to read DHG before making any updates |
DHG-0009 | Cannot create resource that already exists, use update |
DHG-0010 | Invalid user |
DHG-0011 | Deserialization error |
DHG-0012 | Data validation error |
DHG-0013 | Invalid nin (fnr/dnr) |
DHG-0015 | Invalid or inactive maternity record id |
DHG-0016 | Invalid code system |
DHG-0017 | Resource is deleted, cannot be updated |