Overview
The Suki SDK provides a structured and consistent error handling system to help you gracefully manage errors such as initialization failures, patient creation issues, and note submission problems. All errors emitted by the SDK follow a consistent structure with error codes, names, and optional reasons to help you debug efficiently.Listening For Errors
You can 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.
- JavaScript
- React
JavaScript
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:
- JavaScript
- React
JavaScript
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.