try-promise
v1.0.0
Published
Create a promise for exception management
Downloads
11
Readme
try-promise
Requirements
- Node >= 5.0.0, with
--es-staging
flag
Usage
Using class
var Try = require('try-promise'); // Try is a subclass of Promise
new Try(act, args).then(onfulfill, onreject);
act(...args)
would be executedonfulfill(result)
would be executed withresult = act(...args)
if no error was thrownonreject(error)
would be executed ifact(...args)
throwerror
Using function
var tryCatch = require('try-promise').try;
var promise = tryCatch(act, args).then(onfulfill, onreject);