Error Handling
The Clossir SDK throws typed exceptions for all API errors. Every 4xx and 5xx response from
the Clossir API returns an RFC 9457
application/problem+json body, which the SDK parses into a SignumProblemDetailsError.
Catching errors
Error hierarchy
SignumProblemDetailsError is the primary error type — the API standardizes on RFC 9457
for all error responses. SignumDefaultError exists as a fallback but should not occur
under normal conditions.
HTTPClientError subtypes represent transport-layer failures (network issues, timeouts)
rather than API responses.
Type narrowing
TypeScript narrows the type after an instanceof check, giving you access to the
structured fields:
Extension fields
Problem+json responses may include fields beyond the standard RFC 9457 set — for example,
the guard middleware includes resolution hints when a prerequisite check fails. Access
these via the data$ property:
Branching on error type
The type field uses URN-style identifiers that categorize the error. Use it for
programmatic error handling:
Standalone functions (Result pattern)
The SDK also exposes standalone functions that return Result<T, E> instead of throwing.
This is useful for functional/railway-style error handling:
Next steps
- Retries & Backoff — configure automatic retry for transient errors
- Async Operations — handle 202 command responses