src/lib/errors.js
function HttpError(message, options) {
    // handle constructor call without 'new'
    if (!(this instanceof HttpError)) {
        return new HttpError(message, options);
    }

    HttpError.super_.call(this);
    Error.captureStackTrace(this, this.constructor);
    this.name = 'HttpError';
    this.message = message;
    this.status = 500;

    options = options || {};
    if (options.code)     { this.code = options.code; }
    if (options.errors)   { this.errors = options.errors; }
    if (options.headers)  { this.headers = options.headers; }
    if (options.cause)    { this.cause = options.cause; }
}
function HttpError(message, options) {
    // handle constructor call without 'new'
    if (!(this instanceof HttpError)) {
        return new HttpError(message, options);
    }

    HttpError.super_.call(this);
    Error.captureStackTrace(this, this.constructor);
    this.name = 'HttpError';
    this.message = message;
    this.status = 500;

    options = options || {};
    if (options.code)     { this.code = options.code; }
    if (options.errors)   { this.errors = options.errors; }
    if (options.headers)  { this.headers = options.headers; }
    if (options.cause)    { this.cause = options.cause; }
}
function HttpError ( message , options ) { // handle constructor call without 'new' if ( ! ( this instanceof HttpError ) ) { return new HttpError ( message , options ) ; } HttpError . super_ . call ( this ) ; Error . captureStackTrace ( this , this . constructor ) ; this . name = 'HttpError' ; this . message = message ; this . status = 500 ; options = options || { } ; if ( options . code ) { this . code = options . code ; } if ( options . errors ) { this . errors = options . errors ; } if ( options . headers ) { this . headers = options . headers ; } if ( options . cause ) { this . cause = options . cause ; } }
All HTTP Errors will extend from this object
All HTTP Errors will extend from this object