try-promise

1.0.0 • Public • Published

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 executed

  • onfulfill(result) would be executed with result = act(...args) if no error was thrown

  • onreject(error) would be executed if act(...args) throw error

Using function

var tryCatch = require('try-promise').try;
var promise = tryCatch(act, args).then(onfulfill, onreject);

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i try-promise

      Weekly Downloads

      2

      Version

      1.0.0

      License

      MIT

      Last publish

      Collaborators

      • khai96_