lib/index.js
function makeErrFromCode(statusCode) {
    // assert!
    assert.number(statusCode, 'statusCode');
    assert.equal(statusCode >= 400, true);

    // drop the first arg
    var args = _.drop(_.toArray(arguments));
    var name = helpers.errNameFromCode(statusCode);

    var ErrCtor = httpErrors[name];

    // assert constructor was found
    assert.func(ErrCtor);

    // pass every other arg down to constructor
    return makeInstance(ErrCtor, makeErrFromCode, args);
}
function makeErrFromCode(statusCode) {
    // assert!
    assert.number(statusCode, 'statusCode');
    assert.equal(statusCode >= 400, true);

    // drop the first arg
    var args = _.drop(_.toArray(arguments));
    var name = helpers.errNameFromCode(statusCode);

    var ErrCtor = httpErrors[name];

    // assert constructor was found
    assert.func(ErrCtor);

    // pass every other arg down to constructor
    return makeInstance(ErrCtor, makeErrFromCode, args);
}
function makeErrFromCode ( statusCode ) { // assert! assert . number ( statusCode , 'statusCode' ) ; assert . equal ( statusCode >= 400 , true ) ; // drop the first arg var args = _ . drop ( _ . toArray ( arguments ) ) ; var name = helpers . errNameFromCode ( statusCode ) ; var ErrCtor = httpErrors [ name ] ; // assert constructor was found assert . func ( ErrCtor ) ; // pass every other arg down to constructor return makeInstance ( ErrCtor , makeErrFromCode , args ) ; }
create an error object from an http status code.
first arg is status code, all subsequent args
passed on to the constructor. only works for regular
HttpErrors, not RestErrors.
@public
@function makeErrFromCode
@param    {Number} statusCode the http status code
@returns  {Error}             an error instance
create an error object from an http status code . first arg is status code all subsequent args passed on to the constructor . only works for regular HttpErrors not RestErrors .