@prisma-next/errors
Internal package. This package is an implementation detail of prisma-next
and is published only to support its runtime. Its API is unstable and may change
without notice. Do not depend on this package directly; install prisma-next instead.
Structured error types and factories for CLI and runtime error reporting.
Overview
This package provides CliStructuredError (the shared error class) and factory functions for creating structured errors with error codes, fix suggestions, and machine-readable metadata. Errors are split across two entry points by domain:
./control — CLI errors (PN-CLI-4xxx): config validation, file resolution, migration planning
./execution — Runtime errors (PN-RUN-3xxx): contract verification, hash mismatch, database signing
Usage
import { CliStructuredError, errorConfigFileNotFound } from '@prisma-next/errors/control';
import { errorHashMismatch } from '@prisma-next/errors/execution';
throw errorConfigFileNotFound('/path/to/config.ts');
throw errorHashMismatch({ expected: 'abc123', actual: 'def456' });
if (CliStructuredError.is(caught)) {
const envelope = caught.toEnvelope();
}
Entry points
./control | CLI | PN-CLI-4xxx | CliStructuredError class, CliErrorEnvelope/CliErrorConflict types, 14 CLI factory functions, errorUnexpected |
./execution | RUN | PN-RUN-3xxx | 8 runtime factory functions, ERROR_CODE_DESTRUCTIVE_CHANGES constant |