mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(util) tryCatch
This commit is contained in:
parent
9aed0910fc
commit
7bd426dace
1 changed files with 6 additions and 7 deletions
13
lib/util.js
13
lib/util.js
|
|
@ -673,15 +673,14 @@
|
|||
* function execute param function in
|
||||
* try...catch block
|
||||
*
|
||||
* @param pCallBack
|
||||
* @param callback
|
||||
*/
|
||||
this.tryCatch = function(pCallBack) {
|
||||
this.tryCatch = function(callback) {
|
||||
var ret;
|
||||
try{
|
||||
ret = pCallBack();
|
||||
}
|
||||
catch(pError) {
|
||||
ret = pError;
|
||||
try {
|
||||
ret = callback();
|
||||
} catch(error) {
|
||||
ret = error;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue