diff --git a/packages/vue-cli-plugin-uni/lib/error-reporting.js b/packages/vue-cli-plugin-uni/lib/error-reporting.js index 91752b5a95a3d6319277290cd52011083ec48f2e..fb535f0eb1f6c38df7b174b7f74aa7e78b86c786 100644 --- a/packages/vue-cli-plugin-uni/lib/error-reporting.js +++ b/packages/vue-cli-plugin-uni/lib/error-reporting.js @@ -40,6 +40,12 @@ class ErrorReport { if (!this._shouldReport(err)) { return } + + if (typeof err === 'object') { + try { + err = err.toString() + } catch (e) {} + } err = normalizePath(err) || '' err = err.replace(this._UNI_INPUT_DIR_REG, 'UNI_INPUT_DIR') @@ -151,5 +157,5 @@ process global.__error_reporting__ && global.__error_reporting__('unhandledRejection', reason) }) .on('uncaughtException', err => { - global.__error_reporting__ && global.__error_reporting__('uncaughtException', err) + global.__error_reporting__ && global.__error_reporting__('uncaughtException', err.stack) })