import type { Dictionary , DriverException } from '@mikro-orm/core' ; import { UniqueConstraintViolationException , ExceptionConverter , TableExistsException } from '@mikro-orm/core' ; export class MongoExceptionConverter extends ExceptionConverter { link convertException ( exception ) { switch ( exception . code ) { case 48 : return new TableExistsException ( exception ) ; case 11000 : return new UniqueConstraintViolationException ( exception ) ; } return super . convertException ( exception ) ; } }