Skip to content

Commit

Permalink
Merge pull request #4 from naseif/dev_tele-ts
Browse files Browse the repository at this point in the history
fix(code): fixed code formatting issues and missing semicolons. implemented error handling and type checking for the API methods
  • Loading branch information
naseif authored Mar 15, 2022
2 parents 69529cd + 83b7912 commit 31572bc
Show file tree
Hide file tree
Showing 3 changed files with 454 additions and 104 deletions.
30 changes: 30 additions & 0 deletions src/helpers/ErrorsController.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export enum Errors {
CLASS_INITIALIZATION_ERROR = "InitializationError",
INVALID_TYPE = "Invalid Type",
MISSING_PARAMS = "Missing Parameters",
INVALID_EVENT = "Invalid Event",
}

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 31572bc

Please sign in to comment.