-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
99 additions
and
18 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* Custom error class representing an API error. | ||
* @class | ||
* @extends {Error} | ||
*/ | ||
export class APIError extends Error { | ||
statusCode: number; | ||
responseBody: string; | ||
|
||
constructor(message: string, statusCode: number, responseBody: string) { | ||
super(message); | ||
this.name = "APIError"; | ||
this.statusCode = statusCode; | ||
this.responseBody = responseBody; | ||
} | ||
} | ||
|
||
/** | ||
* Custom error class representing an Authentication error. | ||
* @class | ||
* @extends {Error} | ||
*/ | ||
export class AuthenticationError extends Error { | ||
statusCode: number; | ||
responseBody: string; | ||
|
||
constructor(message: string, statusCode: number, responseBody: string) { | ||
super(message); | ||
this.name = "AuthenticationError"; | ||
this.statusCode = statusCode; | ||
this.responseBody = responseBody; | ||
} | ||
} | ||
|
||
/** | ||
* Custom error class representing a missing client id error. | ||
* @class | ||
* @extends {Error} | ||
*/ | ||
export class MissingClientIdError extends Error { | ||
constructor() { | ||
super("Client Id must be setup before calling authenticate. Check documentation"); | ||
this.name = "MissingClientIdError"; | ||
} | ||
} | ||
|
||
/** | ||
* Custom error class representing a missing client secret error. | ||
* @class | ||
* @extends {Error} | ||
*/ | ||
export class MissingClientSecretError extends Error { | ||
constructor() { | ||
super("Client Secret must be setup before calling authenticate. Check documentation"); | ||
this.name = "MissingClientSecretError"; | ||
} | ||
} |
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