Skip to content

Introduce catchByCode #40

@medikoo

Description

@medikoo

So we can narrow callback to be called only in case of specific error type:

promise.catchByCode('ENOENT'); // bypass ENOENT errors

promise.catchByCode('ENOENT', function (e) {
  // File not found, proceed with alternative strategy:
  ..
}); 

Consider support for multiple codes handling e.g.:

promise.catchByCode({
  ENOENT: null, // bypass
  EMFILE: function (e) {
    // Maximum number of open file descriptors reached...
    ...
  }
}); 

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions