Skip to content

Instantly share code, notes, and snippets.

@ManotLuijiu
Created June 16, 2021 16:09
Show Gist options
  • Save ManotLuijiu/a1f52a9ff6a4778e5e0e65a7a1b56114 to your computer and use it in GitHub Desktop.
Save ManotLuijiu/a1f52a9ff6a4778e5e0e65a7a1b56114 to your computer and use it in GitHub Desktop.
ES6 Custom Error Class
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