-
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.
feat(API): implemented type checking and error handling for the API m…
…ethods
- Loading branch information
Showing
2 changed files
with
384 additions
and
104 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export enum Errors { | ||
CLASS_INITIALIZATION_ERROR = "InitializationError", | ||
INVALID_TYPE = "Invalid Type", | ||
MISSING_PARAMS = "Missing Parameters", | ||
} | ||
|
||
export class ErrosController extends Error { | ||
/** | ||
* The error message | ||
*/ | ||
|
||
message: string; | ||
|
||
/** | ||
* the error code for this error message | ||
*/ | ||
|
||
errorCode: Errors; | ||
|
||
constructor( | ||
message: string, | ||
code: Errors = Errors.CLASS_INITIALIZATION_ERROR | ||
) { | ||
super(); | ||
this.message = `${code} - ${message}`; | ||
this.errorCode = code; | ||
Error.captureStackTrace(this); | ||
} | ||
} |
Oops, something went wrong.