Created
June 16, 2021 16:09
-
-
Save ManotLuijiu/a1f52a9ff6a4778e5e0e65a7a1b56114 to your computer and use it in GitHub Desktop.
ES6 Custom Error Class
This file contains hidden or 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 ErrorResponse extends Error { | |
constructor(message, statusCode, reason) { | |
super(message); | |
this.statusCode = statusCode; | |
this.reason = reason; | |
this.name = 'ErrorResponse'; | |
} | |
} | |
module.exports = ErrorResponse; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment