UNPKG

monguito

Version:

MongoDB Abstract Repository implementation for Node.js

69 lines (68 loc) 2.68 kB
import mongoose from 'mongoose'; declare abstract class Exception extends Error { constructor(message: string, cause?: Error); } /** * Models a client provided illegal argument exception. */ export declare class IllegalArgumentException extends Exception { /** * Creates an `IllegalArgumentException`, optionally wrapping an error. * @param {string} message the message of the exception. * @param {Error} cause (optional) the wrapped error. */ constructor(message: string, cause?: Error); } /** * Models an entity instantiation exception. */ export declare class InstantiationException extends Exception { /** * Creates an `InstantiationException`, optionally wrapping an error. * @param {string} message the message of the exception. * @param {Error} cause (optional) the wrapped error. */ constructor(message: string, cause?: Error); } /** * Models an undefined persistable domain object constructor exception. */ export declare class UndefinedConstructorException extends Exception { /** * Creates an `UndefinedConstructorException`, optionally wrapping an error. * @param {string} message the message of the exception. * @param {Error} cause (optional) the wrapped error. */ constructor(message: string, cause?: Error); } /** * Models a persistable domain object schema validation rule violation exception. * Since there may be several properties of the persistable domain object that are invalid, * this exception provides means to retrieve the invalid fields altogeher or by kind. */ export declare class ValidationException extends Exception { cause: mongoose.Error.ValidationError; /** * Creates an `ValidationException`, optionally wrapping an error. * @param {string} message the message of the exception. * @param {Error} cause (optional) the wrapped error. */ constructor(message: string, cause: mongoose.Error.ValidationError); /** * Retrieves all the invalid field names of the persistable domain object. * @returns an array with the names of the invalid fields. */ getInvalidFields(): string[]; /** * Retrieves all the non-specified required field names of the persistable domain object. * @returns an array with the names of the required fields that are not specified. */ getInvalidRequiredFields(): string[]; /** * Retrieves all the duplicated unique field names of the persistable domain object. * @returns an array with the names of the unique fields that are duplicated. */ getInvalidUniqueFields(): string[]; private getInvalidFieldsOfKind; } export {};