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

update: error reporting

上级 e416e156
const {
normalizePath,
isInHBuilderX
} = require('@dcloudio/uni-cli-shared/lib/util');
class ErrorReport { class ErrorReport {
static get instance() { static get instance() {
...@@ -12,8 +17,8 @@ class ErrorReport { ...@@ -12,8 +17,8 @@ class ErrorReport {
this._https = null; this._https = null;
this._crypto = null; this._crypto = null;
this._cacheList = []; this._cacheList = [];
this._UNI_INPUT_DIR_REG = new RegExp(process.env.UNI_INPUT_DIR.replace(/\\/g, '\/'), 'g'); this._UNI_INPUT_DIR_REG = new RegExp(normalizePath(process.env.UNI_INPUT_DIR), 'g');
this._UNI_CLI_CONTEXT_REG = new RegExp(process.env.UNI_CLI_CONTEXT.replace(/\\/g, '\/'), 'g'); this._UNI_CLI_CONTEXT_REG = new RegExp(normalizePath(process.env.UNI_CLI_CONTEXT), 'g');
} }
get https() { get https() {
...@@ -23,19 +28,12 @@ class ErrorReport { ...@@ -23,19 +28,12 @@ class ErrorReport {
return this._https; return this._https;
} }
get isInHBuilderX() {
const {
isInHBuilderX
} = require('@dcloudio/uni-cli-shared')
return isInHBuilderX;
}
report(type, err) { report(type, err) {
if (!this._shouldReport(err)) { if (!this._shouldReport(err)) {
return; return;
} }
err = err.replace(/\\/g, '\/') err = normalizePath(err)
err = err.replace(this._UNI_INPUT_DIR_REG, 'UNI_INPUT_DIR') err = err.replace(this._UNI_INPUT_DIR_REG, 'UNI_INPUT_DIR')
err = err.replace(this._UNI_CLI_CONTEXT_REG, 'UNI_CLI_CONTEXT') err = err.replace(this._UNI_CLI_CONTEXT_REG, 'UNI_CLI_CONTEXT')
...@@ -43,7 +41,7 @@ class ErrorReport { ...@@ -43,7 +41,7 @@ class ErrorReport {
np: process.platform, np: process.platform,
nv: process.version, nv: process.version,
cp: process.env.UNI_PLATFORM, cp: process.env.UNI_PLATFORM,
hx: this.isInHBuilderX ? 1 : 0, hx: isInHBuilderX ? 1 : 0,
et: type, et: type,
em: err em: err
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册