Quick summary
The SDK uses a consistent error structure with error codes, names, and optional reasons to help you handle errors like initialization failures, patient creation issues, and note submission problems.
Listen for SDK-wide errors by subscribing to the
Listen for SDK-wide errors by subscribing to the
error event using either the SukiClient instance (JavaScript) or the useSuki hook (React). This allows you to log and respond to issues across authentication, session management, or note handling.Listening for errors
Listen for SDK-wide errors by subscribing to theerror event using either the SukiClient instance (JavaScript) or the useSuki hook (React). This allows you to log and respond to issues across authentication, session management, or note handling.
Error object structure
Every error emitted by the SDK conforms to a predictable shape that includes a top-level code and a details object with contextual information.SukiError.ts
Example
JSON
Handling specific errors
Useswitch statements or conditional logic to handle specific error codes:
Best practices
- Log or report the full
SukiErrorobject for debugging and support. - Use
reasonfield for granular handling or user messaging. - Always show helpful, user-friendly messages when relevant.
- Implement retries for transient errors (e.g., token expiration or network interruptions) to ensure resilience.