Exception hierarchy
Every typed exception thrown by the SDK derives fromEkso.Sdk.Exceptions.EksoException. The base class carries:
RequestId— server-side correlation id, included on supported failures.StatusCode— HTTP status code, when the failure had one.
Catching by shape
Order catches from specific to general:EksoException alone is fine for “log it and surface” paths, but loses the shape information you need to recover.
EksoAuthException
Thrown when auth cannot be recovered automatically. TheReason enum tells you why:
| Reason | Meaning | Recovery |
|---|---|---|
Expired | Access token expired and refresh failed (or no refresh token). | Re-run interactive flow / fetch a fresh API key. |
Invalid | Credential malformed or unknown. | Check credential source. Don’t retry. |
Revoked | Credential explicitly revoked. | Mint a new one. Don’t retry. |
FlowTimeout | OAuth device-code flow timed out before user approved. | Restart the flow. |
AccessDenied | User clicked “Deny” on the consent screen. | Don’t retry without user intent. |
401 from a regular API call doesn’t always surface as EksoAuthException — the SDK first attempts a refresh. You only see this exception when refresh itself fails.
EksoRateLimitException
Thrown onHTTP 429. Always carries a populated RetryAfter (TimeSpan) reflecting the server’s Retry-After header. Honour it — additional rapid calls will continue to 429.
--batch flavoured operations where they exist.
EksoValidationException
Thrown onHTTP 400/422 when the body fails validation. FieldErrors is a map of field name → list of error messages, so you can highlight specific inputs in a form:
name, defaultValue, etc.
EksoNetworkException
Wraps the underlying transport failure (HttpRequestException, TaskCanceledException, etc.) as InnerException. These are typically transient — a brief retry with exponential backoff is reasonable:
EksoValidationException and EksoAuthException will fail identically every time.
EksoApiException
The catch-all for non-2xx responses that don’t match a more specific shape. InspectBody (a JsonElement) for the raw error payload:
EksoApiException may need to add handlers as the surface evolves.
What about Kiota’s ApiException?
The SDK currently surfaces Kiota’s ownApiException verbatim for some endpoints — it’s the lower-level transport exception used internally. You can catch it as a sibling of EksoException if you want to be exhaustive:
ApiException into EksoApiException is on the roadmap for a future minor version.
See also
- Authentication — how to set up auth so refresh works seamlessly.
- CLI/SDK marker — server-side gating that produces 403 responses for some operations.