export const ApiError = class ApiError extends Error { code; status; errors; constructor( status: number, code: string, message: string | undefined, errors?, ) { super(message); this.status = status; this.code = code; this.errors = errors || []; } static UnauthorizedError() { return new ApiError( 401, "unauthorizedError", "Пользователь не авторизован", ); } static BadRequest(code: string, message: string, errors?) { return new ApiError(400, code, message, errors || []); } };