Comparing version 0.3.8 to 0.3.9
@@ -30,23 +30,23 @@ "use strict"; | ||
newFn = function (...args) { | ||
let result = fn.apply(this, getFinalData(this, args, point.before)); | ||
if (result instanceof Promise) { | ||
result = result.then((ret) => { | ||
return getFinalData(this, ret, point.after); | ||
}); | ||
if (point.onError) { | ||
result = result | ||
.catch(error => { | ||
throw getFinalData(this, error, point.onError); | ||
try { | ||
let result = fn.apply(this, getFinalData(this, args, point.before)); | ||
if (result instanceof Promise) { | ||
result = result.then((ret) => { | ||
return getFinalData(this, ret, point.after); | ||
}); | ||
if (point.onError) { | ||
result = result | ||
.catch(error => { | ||
throw getFinalData(this, error, point.onError); | ||
}); | ||
} | ||
return result; | ||
} | ||
return result; | ||
} | ||
else { | ||
try { | ||
else { | ||
return getFinalData(this, result, point.after); | ||
} | ||
catch (error) { | ||
throw getFinalData(this, error, point.onError); | ||
} | ||
} | ||
catch (error) { | ||
throw getFinalData(this, error, point.onError); | ||
} | ||
}; | ||
@@ -53,0 +53,0 @@ } |
{ | ||
"name": "egg-aop", | ||
"version": "0.3.8", | ||
"version": "0.3.9", | ||
"description": "aop for egg.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
16231