Skip to content

Instantly share code, notes, and snippets.

@gisderdube
Created November 13, 2018 14:47
Show Gist options
  • Save gisderdube/bc5393967e4299966f50bf317813afbe to your computer and use it in GitHub Desktop.
Save gisderdube/bc5393967e4299966f50bf317813afbe to your computer and use it in GitHub Desktop.
class CustomError extends Error {
constructor(code = 'GENERIC', status = 500, ...params) {
super(...params)
if (Error.captureStackTrace) {
Error.captureStackTrace(this, CustomError)
}
this.code = code
this.status = status
}
}
module.exports = CustomError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment