From d6f2e236b847aa35233c55856e79dfe9b3a27416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=BA=9A=E7=90=AA?= Date: Mon, 25 Nov 2024 13:38:45 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=E4=BA=91=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1errSubject=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/unicloud/unicloud/cloud-object.test.js | 1 + pages/API/unicloud/unicloud/cloud-object.uvue | 2 ++ uniCloud-aliyun/cloudfunctions/todo/index.obj.js | 2 ++ 3 files changed, 5 insertions(+) diff --git a/pages/API/unicloud/unicloud/cloud-object.test.js b/pages/API/unicloud/unicloud/cloud-object.test.js index ec731d20..fe6f5ed2 100644 --- a/pages/API/unicloud/unicloud/cloud-object.test.js +++ b/pages/API/unicloud/unicloud/cloud-object.test.js @@ -34,6 +34,7 @@ describe('unicloud-import-object', () => { expect(genericDemoReturnTodoTitle).toBe(todoTitle) expect(genericDemoReturnTodoContent).toBe(todoContent) expect(failErrCode).toBe('TEST_ERROR_CODE') + expect(failErrSubject).toBe('fail') expect(failErrDetailTips).toBe('DO_NOT_TRY_AGAIN') expect(failNumberErrCode).toBe(-1) expect(successErrCode).toBe(0) diff --git a/pages/API/unicloud/unicloud/cloud-object.uvue b/pages/API/unicloud/unicloud/cloud-object.uvue index b3abf026..37f1c714 100644 --- a/pages/API/unicloud/unicloud/cloud-object.uvue +++ b/pages/API/unicloud/unicloud/cloud-object.uvue @@ -46,6 +46,7 @@ genericDemoReturnTodoTitle: '', genericDemoReturnTodoContent: '', failErrCode: '', + failErrSubject: '', failErrDetailTips: '', failNumberErrCode: 0, successErrCode: -1, @@ -124,6 +125,7 @@ }).catch((err : any | null) => { const error = err as UniCloudError this.failErrCode = error.errCode as string + this.failErrSubject = error.errSubject as string const detail = error.detail if (detail != null && detail['tips'] != null) { this.failErrDetailTips = detail['tips'] as string diff --git a/uniCloud-aliyun/cloudfunctions/todo/index.obj.js b/uniCloud-aliyun/cloudfunctions/todo/index.obj.js index 93b40955..65bf500a 100644 --- a/uniCloud-aliyun/cloudfunctions/todo/index.obj.js +++ b/uniCloud-aliyun/cloudfunctions/todo/index.obj.js @@ -14,6 +14,7 @@ module.exports = { console.log(random); if (random > 0.5) { return { + errSubject: 'randomFail', errCode: 'RANDOM_FAIL', errMsg: '[预期内的报错]执行失败请重试' } @@ -27,6 +28,7 @@ module.exports = { }, async fail() { return { + errSubject: 'fail', errCode: 'TEST_ERROR_CODE', errMsg: '[预期内的报错]执行失败', tips: 'DO_NOT_TRY_AGAIN' -- GitLab