lib/error/index.js
function LambdaError(code, message, extra, request) {
    Error.captureStackTrace(this, this.constructor);
    this.name = 'LambdaError';
    this.message = `${code}: ${message}`;
    this.code = code;
    this.extra = extra;
    this.request = request;

    // Also capture a native error internally, which
    // we can send to Raygun later
    this.nativeError = new Error(this.message);
    Error.captureStackTrace(this.nativeError, this.constructor);
}
function LambdaError(code, message, extra, request) {
    Error.captureStackTrace(this, this.constructor);
    this.name = 'LambdaError';
    this.message = `${code}: ${message}`;
    this.code = code;
    this.extra = extra;
    this.request = request;

    // Also capture a native error internally, which
    // we can send to Raygun later
    this.nativeError = new Error(this.message);
    Error.captureStackTrace(this.nativeError, this.constructor);
}
function LambdaError ( code , message , extra , request ) { Error . captureStackTrace ( this , this . constructor ) ; this . name = 'LambdaError' ; this . message = ` ${ code } ${ message } ` ; this . code = code ; this . extra = extra ; this . request = request ; // Also capture a native error internally, which // we can send to Raygun later this . nativeError = new Error ( this . message ) ; Error . captureStackTrace ( this . nativeError , this . constructor ) ; }
Create a new error object

@param code - code for the error (for example HTTP response code)
@param message - error message
@param extra - additional metadata sent when reporting the error
@param request - optional request information sent when reporting
@returns error object
Create a new error object