Giter Club home page Giter Club logo

core-error-predicates's People

Contributors

petkaantonov avatar phpnode avatar tjconcept avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

core-error-predicates's Issues

Idea: exports without the Error sufix

Would make something like this possible:

var Err = require('core-error-predicates').Errors

// later
promise.catch(Err.EOF, e => ...)

Remains succinct without the need to .globalize() (and doesn't break static analysis tools)

ESOCKETTIMEDOUT not covered

node 5.x+

{
  "name": "RequestError",
  "message": "Error: ESOCKETTIMEDOUT",
  "cause": {
    "code": "ESOCKETTIMEDOUT",
    "connect": false
  },
  "error": {
    "code": "ESOCKETTIMEDOUT",
    "connect": false
  }, 
    "timeout": 60000,
  }
}

Example script from README doesn't work?

This script below should result in an exception being caught by the FileNotFoundError predicate. Right?

Instead I'm seeing

Unhandled rejection Error: ENOENT: no such file or directory, open 'blah.txt'
    at Error (native)
#!/usr/bin/env node

var Promise = require('bluebird');
require('core-error-predicates').globalize();

var fs = Promise.promisifyAll(require('fs'));

fs.readFileAsync("blah.txt", "utf8").then(function(contents) {
    console.log("file contents:", contents);
})
.catch(FileNotFoundError, function(e) {
    console.log("file blah.txt does not exist");
})
.catch(FileAccessError, function(e) {
    console.log("no permissions to access blah.txt");
});

Object function Object() { [native code] } has no method 'setPrototypeOf'

node 0.10.32, simply requiring as in the example

/Users/duane/Development/remailer/node_modules/core-error-predicates/index.js:42
    Object.setPrototypeOf(CustomError, Error);
           ^
TypeError: Object function Object() { [native code] } has no method 'setPrototypeOf'
    at createClass (/Users/duane/Development/remailer/node_modules/core-error-predicates/index.js:42:12)
    at addError (/Users/duane/Development/remailer/node_modules/core-error-predicates/index.js:8:16)
    at Object.<anonymous> (/Users/duane/Development/remailer/node_modules/core-error-predicates/index.js:47:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/duane/Development/remailer/test.js:1:63)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.