Feilhåndtering
Dersom CarePlan-API returnerer en HTTP feilkode vil respons body inneholde en JSON-feilmelding på FHIR-formatet vist nedenfor.
Vi sender også alle feilkoder i respons header nhn-error-code
.
Du kan bruke denne headeren om du kun er interessert i feilkoden for å slippe å parse response body.
Ved feil vil HTTP status være i 3xx-5xx range. Ved ok vil HTTP status være i 2xx range.
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "fatal",
"code": "exception",
"diagnostics": {
"applicationVersion": "latest",
"eventId": "",
"environment": "local",
"apiVersion": "v1",
"errorMessage": "Ukjent feil",
"errorCode": "CPL-0001",
"fhirPath": "",
"serviceName": "careplan"
}
}
]
}
De mest interessante feltene for de fleste vil være "errorCode" og "errorMessage". Oversikt over kjente feil og feilkoder ligger i oversikten under.
Feilkoder
Autorisering
For feil vedrørende autorisering se egen side.
Applikasjonsfeil
Har prexix "CPL". Funksjonelle feil har i tillegg F, systemfeil får S og feil mot externe systemer får X.
errorCode | errorMessage |
---|---|
CPLS-0001 | Something unexpected went wrong |
CPLF-0002 | Missing required header value |
CPLF-0003 | Invalid header value |
CPLF-0004 | The request was badly formatted |
CPLF-0005 | Invalid FHIR-structure or element |
CPLF-0006 | Action in not available in API |
CPLF-0007 | The requested resource was not found on server |
CPLF-0008 | You cannot make changes to an old version of a resource |
CPLF-0009 | The resource has no changes, so no update can be made |
CPLF-0010 | The given credentials are not allowed for this request |
CPLF-0011 | Could not process request |
CPLX-0012 | Error communicating with external application |
CPLX-0013 | Error communicating with external application |
CPLF-0014 | Duplicate FHIR identifier |
CPLS-0015 | Failed to create resource |
CPLF-0017 | Patient has not given consent to careplan |
CPLF-0018 | User does not have access |
CPLF-0019 | User does not have access |
CPLS-0020 | Failed to update resource |
CPLF-0021 | Could not find referenced resource |
CPLS-0022 | Failed to update audit log |
CPLF-0023 | Missing patient pseudonym |
CPLF-0024 | Missing patient nin |
CPLF-0025 | Missing pseudonym |
CPLF-0026 | Failed to look up nin for user |
CPLF-0027 | Failed to validate nin |
CPLS-0028 | Unable to look up pseudonym for nin |