From 4fd6c1132663de05614e4da7268525e31fe0c55f Mon Sep 17 00:00:00 2001 From: Mathis Date: Tue, 30 Apr 2024 11:57:22 +0200 Subject: [PATCH] feat(interfaces): add ISError interface and ErrorType enum A new interface `ISError` has been added to represent error objects. Also, an enumeration `ErrorType` has been included to cover all possible types of errors that may occur in the application. This improves the structuring of error handling in the project. Signed-off-by: Mathis --- src/interfaces/services/ISError.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/interfaces/services/ISError.ts diff --git a/src/interfaces/services/ISError.ts b/src/interfaces/services/ISError.ts new file mode 100644 index 0000000..94cc46e --- /dev/null +++ b/src/interfaces/services/ISError.ts @@ -0,0 +1,25 @@ +/** + * Represents an error object. + * + * @interface ISError + */ +export interface ISError { + error: ErrorType; + message: string; + result?: unknown; +} + +/** + * Represents the types of errors that can occur in the application. + * + * @enum {number} + */ +export enum ErrorType { + 'InvalidData' = 0, + 'DatabaseError' = 1, + 'ServiceError' = 2, + 'NotFound' = 3, + 'PasswordInvalid' = 4, + 'UnAuthorized' = 5, + 'UnexpectedError' = 6 +} \ No newline at end of file