Skip to content

Commit

Permalink
feat(API): implemented type checking and error handling for the API m…
Browse files Browse the repository at this point in the history
…ethods
  • Loading branch information
naseif committed Mar 15, 2022
1 parent 51f7d05 commit 91c7c89
Show file tree
Hide file tree
Showing 2 changed files with 384 additions and 104 deletions.
29 changes: 29 additions & 0 deletions src/helpers/ErrorsController.ts
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);
}
}
Loading

0 comments on commit 91c7c89

Please sign in to comment.