@dvsa/appdev-api-common
Version:
Utils library for common API functionality
19 lines (18 loc) • 603 B
TypeScript
import type { ErrorObject } from "ajv";
import { HttpStatus } from "../api/http-status-codes";
type ValidationErrorDetails = Partial<ErrorObject[]> | string | null;
export declare class ValidationError extends Error {
private readonly statusCode;
private readonly details;
constructor(statusCode?: HttpStatus, message?: string, details?: ValidationErrorDetails);
toJSON(): {
error: {
name: string;
message: string;
details: ValidationErrorDetails;
statusCode: number;
};
};
private unwrapErrorDetails;
}
export {};