Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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);
}
```