Listening for Errors
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.- JavaScript
- React
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
Handling Specific Errors
Useswitch
statements or conditional logic to handle specific error codes:
- JavaScript
- React
Best Practices
- Log or report the full
SukiError
object for debugging and support. - Use
reason
field 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.