pyldin601 / catch-filter

Function that catches one errors and rethrows another

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

catch-filter

Function that helps to catch specific types of errors and rethrows another.

Example

const catchFilter = require('catch-filter');
try {
  doSomethingThrowing();
} catch (e) {
  catchFilter(
    [TypeError, error => handleTypeError(error)],
    [Error, error => handleOtherError(error)],
  )(e);
}

About

Function that catches one errors and rethrows another

License:MIT License


Languages

Language:JavaScript 100.0%