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 `Atención: ${this.desc}`;
    };
}
