Errors
Error Handling
Error Types
import {
SuiPayError, // Base error class
SuiPayValidationError, // 400 - Request validation errors
SuiPayAuthenticationError, // 401 - API key issues
SuiPayRateLimitError, // 429 - Rate limiting
SuiPayServerError // 5xx - Server-side errors
} from '@suipay/api';Basic Error Handling
try {
const user = await client.user.get();
console.log('User loaded successfully');
} catch (error) {
console.error('Failed to load user:', error.message);
}Specific Error Types
SuiPayValidationError (400)
SuiPayAuthenticationError (401)
SuiPayRateLimitError (429)
SuiPayServerError (5xx)
Comprehensive Error Handling
Best Practices
1. Implement Retry Logic
2. User-Friendly Messages
3. Error Logging
Error Handling Checklist
Last updated