From 0f3a592744fb7115b10a525d91113739cf73144d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=BA=9A=E7=90=AA?= Date: Fri, 28 Jun 2024 12:03:32 +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=A1error=E7=9A=84detail=E5=B1=9E=E6=80=A7=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../unicloud-import-object/unicloud-import-object.test.js | 2 ++ pages/API/unicloud-import-object/unicloud-import-object.uvue | 5 +++++ uniCloud-aliyun/cloudfunctions/todo/index.obj.js | 1 + 3 files changed, 8 insertions(+) diff --git a/pages/API/unicloud-import-object/unicloud-import-object.test.js b/pages/API/unicloud-import-object/unicloud-import-object.test.js index a3c49839..46fbf87c 100644 --- a/pages/API/unicloud-import-object/unicloud-import-object.test.js +++ b/pages/API/unicloud-import-object/unicloud-import-object.test.js @@ -24,6 +24,7 @@ describe('unicloud-import-object', () => { genericDemoReturnTodoTitle, genericDemoReturnTodoContent, failErrCode, + failErrDetailTips, failNumberErrCode, successErrCode, } = await page.data() @@ -33,6 +34,7 @@ describe('unicloud-import-object', () => { expect(genericDemoReturnTodoTitle).toBe(todoTitle) expect(genericDemoReturnTodoContent).toBe(todoContent) expect(failErrCode).toBe('TEST_ERROR_CODE') + expect(failErrDetailTips).toBe('DO_NOT_TRY_AGAIN') expect(failNumberErrCode).toBe(-1) expect(successErrCode).toBe(0) diff --git a/pages/API/unicloud-import-object/unicloud-import-object.uvue b/pages/API/unicloud-import-object/unicloud-import-object.uvue index 4c60b4b5..1b71ea1e 100644 --- a/pages/API/unicloud-import-object/unicloud-import-object.uvue +++ b/pages/API/unicloud-import-object/unicloud-import-object.uvue @@ -42,6 +42,7 @@ genericDemoReturnTodoTitle: '', genericDemoReturnTodoContent: '', failErrCode: '', + failErrDetailTips: '', failNumberErrCode: 0, successErrCode: -1, isUniTest: false @@ -119,6 +120,10 @@ }).catch((err : any | null) => { const error = err as UniCloudError this.failErrCode = error.errCode as string + const detail = error.detail + if (detail != null && detail['tips'] != null) { + this.failErrDetailTips = detail['tips'] + } console.error(error) }) }, diff --git a/uniCloud-aliyun/cloudfunctions/todo/index.obj.js b/uniCloud-aliyun/cloudfunctions/todo/index.obj.js index 51a32594..93b40955 100644 --- a/uniCloud-aliyun/cloudfunctions/todo/index.obj.js +++ b/uniCloud-aliyun/cloudfunctions/todo/index.obj.js @@ -29,6 +29,7 @@ module.exports = { return { errCode: 'TEST_ERROR_CODE', errMsg: '[预期内的报错]执行失败', + tips: 'DO_NOT_TRY_AGAIN' } }, async failWithNumberErrCode() { -- GitLab