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 <yidhra@tuta.io>
This commit is contained in:
Mathis H (Avnyr) 2024-04-30 11:57:22 +02:00
parent 355cb0ec90
commit 4fd6c11326
Signed by: Mathis
GPG Key ID: DD9E0666A747D126

View File

@ -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
}