https://github.com/coderaiser/try-catch
Try-catch wrapper
https://github.com/coderaiser/try-catch
catch javascript nodejs try-catch
Last synced: 2 months ago
JSON representation
Try-catch wrapper
- Host: GitHub
- URL: https://github.com/coderaiser/try-catch
- Owner: coderaiser
- License: mit
- Created: 2014-12-19T15:10:06.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2022-04-27T19:01:36.000Z (over 3 years ago)
- Last Synced: 2025-05-20T23:40:12.622Z (5 months ago)
- Topics: catch, javascript, nodejs, try-catch
- Language: JavaScript
- Homepage: https://gist.github.com/coderaiser/a26e535bc43b5fe1ac4d72624bd6bed2
- Size: 18.6 KB
- Stars: 19
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
# Try Catch [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
[NPMIMGURL]: https://img.shields.io/npm/v/try-catch.svg?style=flat
[NPMURL]: https://npmjs.org/package/try-catch "npm"
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[CoverageURL]: https://coveralls.io/github/coderaiser/try-catch?branch=master
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/try-catch/badge.svg?branch=master&service=github
[BuildStatusURL]: https://github.com/coderaiser/try-catch/actions?query=workflow%3A%22Node+CI%22 "Build Status"
[BuildStatusIMGURL]: https://github.com/coderaiser/try-catch/workflows/Node%20CI/badge.svgFunctional `try-catch` wrapper
## Install
```
npm i try-catch
```## Example
```js
const tryCatch = require('try-catch');
const {parse} = JSON;
const [error, result] = tryCatch(parse, 'hello');if (error)
console.error(error.message);```
## Related
- [try-to-catch](https://github.com/coderaiser/try-to-catch "TryToCatch") - functional try-catch wrapper for promises.
## License
MIT