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

update: error reporting

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