mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-26 19:12:12 -04:00
* fix: show error cause when failing to read metadata * fix: correct changeset package name and add cause assertion tests - Fix changeset to reference @pnpm/resolving.npm-resolver (not @pnpm/npm-resolver) - Add PnpmError cause unit tests in @pnpm/error - Fix npm-resolver tests to actually verify cause on thrown errors (.toThrow() only checks message, not cause/hint/code properties) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Zoltan Kochan <z@kochan.io> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pnpm/error
An error class for pnpm errors
Installation
pnpm add @pnpm/error
Usage
import { PnpmError } from '@pnpm/error'
try {
throw new PnpmError('THE_ERROR_CODE', 'The error message')
} catch (err: any) { // eslint-disable-line
console.log(err.code)
//> ERR_PNPM_THE_ERROR_CODE
console.log(err.message)
//> The error message
}
License
MIT