import type { MongoServerError } from 'mongodb'; import BaseError, { type IError } from '../../utils/errors/base-error'; /** * Converts a MongoDB schema validation error into an HTTP validation error. * * Extracts missing required properties from MongoDB schema validation details * and generates a validation message for each missing property. * * @param err - MongoDB server error with code 121. * @returns HTTP validation error containing missing property errors. */ export declare function handleSchemaValidation(err: MongoServerError): IError; /** * Converts a MongoDB duplicate key error into an HTTP validation error. * * Generates a validation message for a single duplicated field or a * combination of fields when a compound unique index is violated. * * @param err - MongoDB server error with code 11000. * @returns HTTP validation error containing duplicate key errors. */ export declare function handleUniqueValidation(err: MongoServerError): IError; /** * Handles MongoDB server errors and converts supported errors into * HTTP 422 validation errors. * * Supported MongoDB error codes: * - 121: Document schema validation failure. * - 11000: Duplicate key constraint violation. * * @extends BaseError */ export declare class MongoErrorHandler extends BaseError { /** * Creates a MongoDB error handler. * * @param err - MongoDB server error to handle. */ constructor(err: MongoServerError); /** * Indicates whether the error is operational and expected to be handled. */ get isOperational(): boolean; /** * Returns the error class name. */ get name(): string; } //# sourceMappingURL=mongo-error-handler.d.ts.map