Skip to content

Instantly share code, notes, and snippets.

Created January 20, 2020 12:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
'use strict'
const httpStatus = require('http-status')
const errorCodes = require('./errorCodes')
module.exports = function APIError (
status = httpStatus.INTERNAL_SERVER_ERROR,
errorCode = errorCodes.UnkownError,
errors = null
) {
Error.captureStackTrace(this, this.constructor) =
this.message = message
this.status = status
this.errorCode = errorCode
this.errors = errors
require('util').inherits(module.exports, Error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment