Created
November 13, 2018 14:47
-
-
Save gisderdube/bc5393967e4299966f50bf317813afbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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