提交 e416e156 编写于 作者: d-u-a's avatar d-u-a

update: error reporting

上级 16b21d39
...@@ -11,8 +11,9 @@ class ErrorReport { ...@@ -11,8 +11,9 @@ class ErrorReport {
this._instance = null; this._instance = null;
this._https = null; this._https = null;
this._crypto = null; this._crypto = null;
this._cacheList = []; this._cacheList = [];
this._isReporting = false; this._UNI_INPUT_DIR_REG = new RegExp(process.env.UNI_INPUT_DIR.replace(/\\/g, '\/'), 'g');
this._UNI_CLI_CONTEXT_REG = new RegExp(process.env.UNI_CLI_CONTEXT.replace(/\\/g, '\/'), 'g');
} }
get https() { get https() {
...@@ -32,7 +33,11 @@ class ErrorReport { ...@@ -32,7 +33,11 @@ class ErrorReport {
report(type, err) { report(type, err) {
if (!this._shouldReport(err)) { if (!this._shouldReport(err)) {
return; return;
} }
err = err.replace(/\\/g, '\/')
err = err.replace(this._UNI_INPUT_DIR_REG, 'UNI_INPUT_DIR')
err = err.replace(this._UNI_CLI_CONTEXT_REG, 'UNI_CLI_CONTEXT')
const data = JSON.stringify({ const data = JSON.stringify({
np: process.platform, np: process.platform,
...@@ -40,7 +45,7 @@ class ErrorReport { ...@@ -40,7 +45,7 @@ class ErrorReport {
cp: process.env.UNI_PLATFORM, cp: process.env.UNI_PLATFORM,
hx: this.isInHBuilderX ? 1 : 0, hx: this.isInHBuilderX ? 1 : 0,
et: type, et: type,
em: err.replace(/(\().+?(node_modules[\/\\]@dcloudio)/g, '$1$2') em: err
}); });
var hash = this._getMD5(data); var hash = this._getMD5(data);
...@@ -109,7 +114,7 @@ Object.assign(ErrorReport.prototype, { ...@@ -109,7 +114,7 @@ Object.assign(ErrorReport.prototype, {
}); });
function report(type, err) { function report(type, err) {
//ErrorReport.instance.report(type, err); ErrorReport.instance.report(type, err);
} }
global.__error_reporting__ = report global.__error_reporting__ = report
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册