http-error.js 378 B

123456789101112131415
  1. module.exports = class HttpError extends Error {
  2. constructor (message, code, headers) {
  3. super(message)
  4. // Maintains proper stack trace (only available on V8)
  5. /* istanbul ignore next */
  6. if (Error.captureStackTrace) {
  7. Error.captureStackTrace(this, this.constructor)
  8. }
  9. this.name = 'HttpError'
  10. this.code = code
  11. this.headers = headers
  12. }
  13. }