Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
用 UQPAY Node.js SDK 处理 API 错误、配置重试并理解错误类型。
UQPayError
import { AuthenticationError, ValidationError, NotFoundError, RateLimitError, ServerError, NetworkError, SimulatorNotAvailableError, } from '@uqpay/sdk'
message
string
httpStatus
number
type
code
try { const account = await client.account.accounts.retrieve('acc-123') } catch (err) { if (err instanceof NotFoundError) { console.log('账户未找到') } else if (err instanceof ValidationError) { console.log('请求参数错误:', err.message) } else if (err instanceof RateLimitError) { console.log('触发限流,SDK 会自动重试') } else if (err instanceof NetworkError) { console.log('网络错误:', err.message) } else if (err instanceof SimulatorNotAvailableError) { console.log('模拟器仅在沙盒可用') } }
// 全局——创建 client 时设置 const client = new UQPayClient({ // ... maxRetries: 3, }) // 单次请求——覆盖全局设置 await client.account.accounts.retrieve('acc-123', { maxRetries: 0 })