# try-promise

> Create a promise for exception management

Latest version **1.0.0** (published 2016-03-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install try-promise
pnpm add try-promise
yarn add try-promise
bun add try-promise
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-03-20 |
| First published | 2016-03-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 5.0.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Hoàng Văn Khải |
| Maintainers | khai96_ |

## Links

- npm: https://www.npmjs.com/package/try-promise
- Repository: https://github.com/ksxnodemodules/try-promise
- Homepage: https://github.com/ksxnodemodules/try-promise#readme
- Issues: https://github.com/ksxnodemodules/try-promise/issues
- npm.io page: https://npm.io/package/try-promise

## Recent versions

- 1.0.0 (latest) — 2016-03-20
- 0.0.0 — 2016-03-20

## README

# try-promise

## Requirements

 * Node >= 5.0.0, with `--es-staging` flag

## Usage

### Using class

```javascript
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

```javascript
var tryCatch = require('try-promise').try;
var promise = tryCatch(act, args).then(onfulfill, onreject);
```

---
_Source: https://npm.io/package/try-promise · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
