-
-
Save jbis9051/15ff9ed0b18df879a0cb548722d6caa7 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 APIError extends Error { | |
public readonly name: string; | |
public readonly httpCode: HttpStatusCode; | |
constructor(name: string, httpCode: HttpStatusCode, description: string) { | |
super(description); | |
this.name = name; | |
this.httpCode = httpCode; | |
Error.captureStackTrace(this); | |
} | |
} | |
enum HttpStatusCode { | |
OK = 200, | |
BAD_REQUEST = 400, | |
NOT_FOUND = 404, | |
INTERNAL_SERVER = 500, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment