first commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
export interface IServerError {
|
||||
readonly code: number;
|
||||
readonly desc: string;
|
||||
}
|
||||
|
||||
export class ApiValidationError implements IServerError {
|
||||
readonly code: number;
|
||||
readonly desc: string;
|
||||
|
||||
constructor(code: number, desc: string) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
||||
|
||||
export class ApiError extends ApiValidationError {
|
||||
constructor(code: number, desc: string) {
|
||||
super(code, desc);
|
||||
}
|
||||
|
||||
format = (): string => {
|
||||
return `Ha ocurrido un error: ${this.desc}`;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user