Comparing version 1.0.6 to 1.0.7
@@ -21,5 +21,12 @@ /** | ||
err = new Error(JSON.stringify(err)); | ||
err.selfThrew = true; | ||
} | ||
logger.warn(err); | ||
// 开发者自己抛的日志报警,捕获的错误打错误日志 | ||
if (err.selfThrew) { | ||
logger.warn(err); | ||
} else { | ||
logger.error(err); | ||
} | ||
/* eslint-disable eqeqeq */ | ||
@@ -26,0 +33,0 @@ // ENOENT support |
@@ -105,3 +105,3 @@ /** | ||
body = new Buffer(body, 'binary').toString('base64'); | ||
body = Buffer.from(body, 'binary').toString('base64'); | ||
data.gzip = 1; | ||
@@ -108,0 +108,0 @@ data.msg = body; |
@@ -18,2 +18,4 @@ /** | ||
let throwError = app.context.throw; | ||
let methods = { | ||
@@ -90,2 +92,12 @@ | ||
throw(...args) { | ||
try { | ||
throwError.apply(null, args); | ||
} catch (e) { | ||
// 标记是自己抛出的异常 | ||
e.selfThrew = true; | ||
throw e; | ||
} | ||
}, | ||
onerror(err) { | ||
@@ -92,0 +104,0 @@ if (null == err) { |
{ | ||
"name": "akb", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"main": "./lib/akb.js", | ||
@@ -24,4 +24,7 @@ "scripts": { | ||
"devDependencies": { | ||
"babel-core": "^6.14.0", | ||
"babel-plugin-transform-async-to-generator": "^6.8.0", | ||
"babel-polyfill": "^6.23.0", | ||
"babel-preset-es2016": "^6.22.0", | ||
"babel-preset-stage-2": "^6.22.0", | ||
"babel-register": "^6.23.0", | ||
"mocha": "^3.1.2", | ||
@@ -28,0 +31,0 @@ "should": "^11.1.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
81895
2582
8