优化PDA装柜完成错误提示
This commit is contained in:
@@ -651,6 +651,14 @@
|
|||||||
isTaskConflict(error) {
|
isTaskConflict(error) {
|
||||||
return String(error?.code || '') === 'A0409' || Number(error?.statusCode) === 409
|
return String(error?.code || '') === 'A0409' || Number(error?.statusCode) === 409
|
||||||
},
|
},
|
||||||
|
remoteFailureMessage(error, fallback = '操作失败') {
|
||||||
|
const raw = String(error?.message || '').trim()
|
||||||
|
const message = /^internal server error$/i.test(raw)
|
||||||
|
? '服务端处理异常,请联系管理员'
|
||||||
|
: (raw || fallback)
|
||||||
|
const reference = String(error?.requestId || error?.traceId || '').trim()
|
||||||
|
return reference ? `${message}(请求编号:${reference})` : message
|
||||||
|
},
|
||||||
async refreshAfterTaskConflict(message) {
|
async refreshAfterTaskConflict(message) {
|
||||||
const requestedTaskId = this.remoteTaskId || this.currentBox.taskId
|
const requestedTaskId = this.remoteTaskId || this.currentBox.taskId
|
||||||
this.submitId = ''
|
this.submitId = ''
|
||||||
@@ -1405,7 +1413,8 @@
|
|||||||
await this.refreshAfterTaskConflict(error.message || '订舱、装柜关联或证据状态已变化,请刷新后重试')
|
await this.refreshAfterTaskConflict(error.message || '订舱、装柜关联或证据状态已变化,请刷新后重试')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.remoteError = error.network ? '网络失败,装柜完成未提交' : (error.message || '装柜完成失败')
|
this.debugSubmit('complete.error', { message: error.message || '', code: error.code || '', statusCode: error.statusCode || '', requestIdFromServer: error.requestId || '', traceId: error.traceId || '' })
|
||||||
|
this.remoteError = error.network ? '网络失败,装柜完成未提交' : this.remoteFailureMessage(error, '装柜完成失败')
|
||||||
this.showToast('装柜完成失败', 'error')
|
this.showToast('装柜完成失败', 'error')
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|||||||
@@ -243,3 +243,12 @@ test('picking mutations stay closed until the canonical task has been claimed',
|
|||||||
assert.match(body, /if \(!this\.requirePickingOperation\(\)\) return/, `${method} should wait for claim`)
|
assert.match(body, /if \(!this\.requirePickingOperation\(\)\) return/, `${method} should wait for claim`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('completion shows a Chinese server failure with a request correlation id', () => {
|
||||||
|
assert.match(page, /remoteFailureMessage\(error, fallback = '操作失败'\)/)
|
||||||
|
assert.match(page, /\^internal server error\$\/i/)
|
||||||
|
assert.match(page, /服务端处理异常,请联系管理员/)
|
||||||
|
assert.match(page, /请求编号/)
|
||||||
|
assert.match(page, /requestIdFromServer: error\.requestId/)
|
||||||
|
assert.match(page, /this\.remoteFailureMessage\(error, '装柜完成失败'\)/)
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user