Mediloop
EXAMPLE ERRORPopular

Patient Data Synchronization – Error Handling

Understand and handle errors that can occur during data synchronization.

Language
TypeScript
Use case
Patient data
Complexity
Intermediate
Updated
May 12, 2024
Overview
Code
Setup
Run
Output
Error handling
Errors are inevitable. The SDK provides structured error information, automatic retries for transient errors, and tools to help you identify and resolve issues quickly.

Common error types

Authentication error401No
Authorization error403No
Validation error400No
FHIR validation error422No
Rate limit exceeded429Yes
Server error5xxYes
Network errorYes
Conflict / Duplicate409No

Error response example

jsonCopy
{
  "error": {
    "code": "FHIR_VALIDATION_ERROR",
    "message": "Observation.code must be a valid LOINC code",
    "details": {
      "field": "Observation.code",
      "issue": "Unknown LOINC code 1234-5"
    },
    "resourceType": "Observation",
    "correlationId": "req_01H..."
  }
}

How errors are handled

1
Request is sent
The SDK sends your request to Mediloop.
2
Error occurs
Mediloop returns an error response.
3
SDK processes the error
The SDK classifies the error and decides whether to retry.
4
Retry (if applicable)
Automatic retry with exponential backoff for retryable errors.
5
Final result
Success or failure returned to your application.

Retry & idempotency

typescriptCopy
const client = new MediloopClient({
 retry: { maxAttempts: 3, baseDelayMs: 1000, backoffFactor: 2 },
 idempotencyKey: true
});

Partial synchronization failures

182
Succeeded
8
Failed
35
Skipped

Inspect & recover failed records

View failed records in the Developer Console
Download error details & original payload
Correct the data and retry synchronization
Track fix status until resolved