A TypeScript library v5.0.0 for formatting Prisma Client errors into user-friendly, consistent messages. Supports known request errors (unique constraint, foreign key, not found), validation errors, initialization errors, and panic errors. Allows custom formatting via callback. Requires @nestjs/common ^10.0.0, @nestjs/core ^10.0.0, @prisma/client >=4.0.0. Actively maintained on GitHub with MIT license. Differentiated by structured output with path/message and full NestJS integration.
npm install prisma-error-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a PrismaExceptionFormatter and uses it to catch and format a Prisma error in a create operation.
Update import from older versions. Import { PrismaExceptionFormatter } from 'prisma-error-formatter'.Replace calls to deprecated methods with formatter.formatError(error).
Use new PrismaExceptionFormatter() instead of PrismaExceptionFormatter().
Use ESM imports (import) or dynamic import() in CJS.
Install @nestjs/common and @nestjs/core if using with NestJS, otherwise ignore.
Use new PrismaExceptionFormatter() and ensure named import: import { PrismaExceptionFormatter } from 'prisma-error-formatter'.Run npm install prisma-error-formatter. In tsconfig.json, set moduleResolution to 'node16' or 'nodenext'.