feat(dongchedi): translate platform "server exception" into actionable copy
Map dongchedi adapter failures (raw "server exception" or dongchedi_platform_exception) to a Chinese prompt steering the user to the dongchedi backend, so renderer/admin views and desktop-task error payloads no longer surface the opaque platform message.
This commit is contained in:
@@ -24,6 +24,8 @@ import { getPublishPlatformMeta, normalizePublishPlatformId } from '@/lib/publis
|
||||
const PAGE_SIZE = 10
|
||||
const INLINE_ERROR_HEAD_CHARS = 52
|
||||
const INLINE_ERROR_TAIL_CHARS = 10
|
||||
const DONGCHEDI_PLATFORM_EXCEPTION_MESSAGE =
|
||||
'懂车帝平台返回异常,请打开懂车帝后台查看并处理平台提示,确认账号状态后再重试。'
|
||||
|
||||
type PublishTaskStatus = DesktopTaskInfo['status']
|
||||
|
||||
@@ -93,7 +95,7 @@ function isPendingStatus(status: PublishTaskStatus): boolean {
|
||||
return status === 'queued' || status === 'in_progress'
|
||||
}
|
||||
|
||||
function normalizeTaskErrorMessage(messageText: string | null): string | null {
|
||||
function normalizeTaskErrorMessage(messageText: string | null, platform?: string | null): string | null {
|
||||
const normalized = extractString(messageText)
|
||||
if (!normalized) {
|
||||
return null
|
||||
@@ -104,6 +106,13 @@ function normalizeTaskErrorMessage(messageText: string | null): string | null {
|
||||
if (normalized.includes('adapter is not implemented for this platform')) {
|
||||
return '当前平台的桌面发布适配器未实现,任务已按失败处理。'
|
||||
}
|
||||
if (
|
||||
platform === 'dongchedi' &&
|
||||
(/\bserver[\s_-]*exception\b/i.test(normalized) ||
|
||||
/\bdongchedi_platform_exception\b/i.test(normalized))
|
||||
) {
|
||||
return DONGCHEDI_PLATFORM_EXCEPTION_MESSAGE
|
||||
}
|
||||
return normalized
|
||||
}
|
||||
|
||||
@@ -417,6 +426,7 @@ const publishTasks = computed<PublishTaskItem[]>(() =>
|
||||
extractString(taskError.message) ??
|
||||
extractString(taskError.detail) ??
|
||||
extractString(taskError.code),
|
||||
platformId,
|
||||
),
|
||||
complianceBlockedRecordId,
|
||||
complianceBlockedAt: task.compliance_blocked_at ?? null,
|
||||
|
||||
Reference in New Issue
Block a user