优化
This commit is contained in:
@@ -25,8 +25,9 @@ export function sanitizeUserMessage(message, fallback = '操作失败') {
|
||||
return sanitized || fallback
|
||||
}
|
||||
|
||||
export function formatApiError(error, fallback = '操作失败') {
|
||||
export function formatApiError(error, fallback = '操作失败', includeDiagnostics = true) {
|
||||
const message = sanitizeUserMessage(error?.message, fallback)
|
||||
if (!includeDiagnostics) return message
|
||||
const code = String(error?.code ?? '').trim()
|
||||
const requestId = String(error?.requestId ?? '').trim()
|
||||
const traceId = String(error?.traceId ?? '').trim()
|
||||
|
||||
Reference in New Issue
Block a user