Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pyldin601/catch-filter
Function that catches one errors and rethrows another
https://github.com/pyldin601/catch-filter
Last synced: about 1 month ago
JSON representation
Function that catches one errors and rethrows another
- Host: GitHub
- URL: https://github.com/pyldin601/catch-filter
- Owner: pyldin601
- License: mit
- Created: 2017-10-05T19:57:14.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T08:15:58.000Z (about 1 year ago)
- Last Synced: 2024-12-08T22:00:11.329Z (about 2 months ago)
- Language: JavaScript
- Size: 34.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# catch-filter
Function that helps to catch specific types of errors and rethrows another.## Example
```javascript
const catchFilter = require('catch-filter');
try {
doSomethingThrowing();
} catch (e) {
catchFilter(
[TypeError, error => handleTypeError(error)],
[Error, error => handleOtherError(error)],
)(e);
}
```