@aequum/typeorm
Version:
aequum TypeORM tools for repository, pagination, CRUD/CRUDL, configs and utils
12 lines (11 loc) • 574 B
TypeScript
import { DuplicateEntryException } from '@aequum/exceptions/data';
/**
* Check if the error is a TypeORMError and if it is a duplicate error
*/
export declare function isDuplicateError(err: any): false | RegExpMatchArray | null;
/**
* Check if the error is a duplicate entry error, if it is,
* returns a `new DuplicateEntryException` with passed
* arguments, otherwise returns the orignal error.
*/
export declare function duplicateEntryExceptionOrError<T extends Error>(err: T, message?: any, data?: any, duplicatedProperties?: string[]): T | DuplicateEntryException;