Errors and retries

Every failure is an OvokException with status, code, type, message,

  • Stable unknown
  • Release candidate since 0.1.0-rc.3
  • Development since 0.1.0-dev.17+c121e27

Every failure is an OvokException with status, code, type, message, traceId, requestId, retryAfterMs and fieldErrors. Catch a subclass to handle one case:

ClassWhen
OvokValidationException400, 422
OvokAuthenticationException401
OvokPermissionException403: signed in, but not allowed
OvokNotFoundException404
OvokConflictException409
OvokRateLimitException429
OvokServiceException5xx
OvokConnectionExceptionNo answer: network failure or timeout
OvokConfigExceptionA bad option, or an action this client cannot take
try {
  await ovok.fhir.read('Patient', id);
} on OvokNotFoundException {
  // show "not found"
} on OvokException catch (error) {
  log('Ovok failed', error: error.traceId);
}

Quote traceId when you report a problem.

Retries and timeouts

  • Retried requests: GET, PUT, DELETE and conditional creates retry on 429, 502, 503, 504 or a connection failure, up to maxNetworkRetries times.
  • Backoff: the first wait is 300 ms and doubles each time; Retry-After wins, and no wait is longer than 5 s.
  • Timeouts: a timed-out request fails with OvokConnectionException. package:http cannot cancel it, so it may still reach the server.

Last updated on

On this page