toClientError

Converts various exception types into standardized client error codes for server communication.

This function maps internal SDK exceptions to predefined error codes that can be safely sent to the authentication server. It handles different categories of errors:

  • Registration errors: When the device lacks required cryptographic keys

  • Authentication errors: When user authentication fails or is aborted

  • Timeout errors: When operations exceed configured time limits

  • Support errors: When the device lacks required capabilities

  • Cancellation errors: When operations are cancelled (re-thrown to preserve cancellation semantics)

  • General errors: All other exceptions are treated as abort conditions

The function preserves coroutine cancellation semantics by re-throwing CancellationException (except TimeoutCancellationException which is converted to a timeout error code).

Return

A standardized error code string suitable for server communication

Parameters

e

The exception to convert to a client error code

See also

Throws

CancellationException

If the exception is a CancellationException (preserves cancellation)