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:
parent
355cb0ec90
commit
4fd6c11326
25
src/interfaces/services/ISError.ts
Normal file
25
src/interfaces/services/ISError.ts
Normal 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
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user