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.
You can listen for SDK-wide errors by subscribing to the
You can 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.Overview
The SDK uses a consistent error structure to help you handle errors like initialization failures, patient creation issues, and note submission problems. All SDK errors include an error code, name, and optional reason to make debugging easier.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.