Errors and retries
Every failed call throws a MountayaException. The client retries what is worth retrying before it gives up.
ApiException is a failure the API answered, with its status, code, errors and requestId. A timeout or a dropped connection is a ConnectionException instead.
A 402 is fixed in your agreement or billing settings, not in code. Its message says which.
Branch on a code by its ApiErrorCode constant. hasCode asks every entry, not only the first:
Retries are on by default: two retries with backoff, on 429, 502, 503, 504 and dropped connections. Writes are retried safely, because each one carries an idempotency key.
The client's timeout is 30 seconds. A call you no longer want is withdrawn by cancelling its coroutine:
onResponse hears every answer, successes included:
Quote the requestId to support: it is the id the API recorded the request under.