Comparing version 4.1.6 to 4.2.0
@@ -753,4 +753,61 @@ // Generated by CoffeeScript 1.10.0 | ||
this.run = function(method, on_error, on_after_error) { | ||
var trycatch, trycatch_settings; | ||
if (on_error == null) { | ||
on_error = null; | ||
} | ||
if (on_after_error == null) { | ||
on_after_error = null; | ||
} | ||
/* Provide asynchronous error handling and long stacktraces. Usage: | ||
To run a method, catch all the synchronous and asynchronous errors and print a stacktrace | ||
to `process.stderr` (using `console.error`): | ||
```coffee | ||
CND.run -> f 42 | ||
``` | ||
Same as the above, but do the error handling yourself: | ||
```coffee | ||
CND.run ( -> f 42 ), ( error ) -> foobar() | ||
``` | ||
Same as the last, except have CND output the error's stacktrace and be called back afterwards: | ||
```coffee | ||
CND.run ( -> f 42 ), null, ( error ) -> foobar() | ||
``` | ||
NB.: `CND.run` may be made configurable in the future; as of now, it is hardwired to use colors | ||
and always provide long (cross-event) stack traces. Colors used are blue for NodeJS VM built-ins, | ||
green for errors originating from modules installed under `node_modules`, and yellow for everything | ||
else. | ||
*/ | ||
if (on_error == null) { | ||
on_error = function(error) { | ||
console.error(error['stack']); | ||
if (on_after_error != null) { | ||
return on_after_error(error); | ||
} | ||
}; | ||
} | ||
trycatch = require('trycatch'); | ||
trycatch_settings = { | ||
'long-stack-traces': true, | ||
'colors': { | ||
'node': 'blue', | ||
'node_modules': 'green', | ||
'default': 'yellow' | ||
} | ||
}; | ||
trycatch.configure(trycatch_settings); | ||
trycatch(method, on_error); | ||
return null; | ||
}; | ||
}).call(this); | ||
//# sourceMappingURL=BITSNPIECES.js.map |
{ | ||
"name": "cnd", | ||
"version": "4.1.6", | ||
"version": "4.2.0", | ||
"description": "a grab-bag NodeJS package mainly for functionalities that used to live in coffeenode-trm, coffeenode-bitsnpieces, and coffeenode-types", | ||
@@ -28,3 +28,5 @@ "main": "lib/main.js", | ||
"homepage": "https://github.com/loveencounterflow/cnd", | ||
"dependencies": {}, | ||
"dependencies": { | ||
"trycatch": "^1.5.21" | ||
}, | ||
"devDependencies": { | ||
@@ -31,0 +33,0 @@ "guy-test": "^1.3.1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
252071
2485
1
+ Addedtrycatch@^1.5.21
+ Addedansi-styles@1.1.0(transitive)
+ Addedhookit@1.1.3(transitive)
+ Addedtrycatch@1.5.21(transitive)