From 73def8718ea8920ca9e410a101298afcbea1549b Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Fri, 22 Jul 2022 10:37:45 +0800 Subject: [PATCH] 完善报错上报内容 --- bases/Fetcher.js | 6 +++--- common/Bridge.js | 25 +++++++++++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/bases/Fetcher.js b/bases/Fetcher.js index 4fd1e10..fdeea51 100644 --- a/bases/Fetcher.js +++ b/bases/Fetcher.js @@ -150,8 +150,8 @@ // 捕获响应 options && options.onCapture && options.onCapture({ url: this._createUrlPrefix(options) + url, - request: JSON.stringify(data), - response: JSON.stringify(response.data), + request: data, + response: response.data, httpCode: response.statusCode, }); /** @@ -173,7 +173,7 @@ // 捕获响应 options && options.onCapture && options.onCapture({ url: this._createUrlPrefix(options) + url, - request: JSON.stringify(data), + request: data, httpCode: error && error.status, httpMsg: msg + (error.message ? (' / ' + error.message) : ''), }); diff --git a/common/Bridge.js b/common/Bridge.js index daa7d07..33441c2 100644 --- a/common/Bridge.js +++ b/common/Bridge.js @@ -337,10 +337,27 @@ baseArr, fileName, }; - $fileTrans.transBaseDataToObjUrl(baseData, objUrl => { - this._data.fileLoaded[bridgeName] = objUrl; - callback && callback(objUrl); - }); + try { + $fileTrans.transBaseDataToObjUrl(baseData, objUrl => { + this._data.fileLoaded[bridgeName] = objUrl; + callback && callback(objUrl); + }); + } catch (e) { + onError({ + method: 'img_read@merge_after_base64_loaded', + request: { + ...loadData, + totalCount, + }, + response: { + result: res.result, + msg: res.msg, + 'total_size': res.totalSize, + data: '(' + (res.data || '').length + '个base64字符...)', + }, + message: 'Base64合并解析异常!', + }); + } } }); }; -- Gitblit v1.9.1