You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a tiny helper that unwraps `unknown` thrown values into a
readable message string, with a stable 'Unknown error' fallback for
nullish / empty-message / undefined cases.
Lives in two places because src/ and scripts/ are separate graphs:
- src/error.ts — exported alongside PurlError + PurlInjectionError
- scripts/utils/error-message.mts — mirror for build tooling
Migrates every occurrence of the
`e instanceof Error ? e.message : String(e)` pattern to
`errorMessage(e)`. Covers:
- 16 src/purl-types/ files (exists-check catch blocks)
- 20 scripts/*.mts + scripts/validate/*.mts files (CLI + validator
error reporting)
- A 'reason ?? ""' fallback in scripts/test.mts and an ad-hoc
`err ?? 'unknown'` in scripts/tour.mts — both subsumed by the
helper's 'Unknown error' fallback
Tests for the helper in test/purl-edge-cases.test.mts cover Error,
Error subclass (TypeError, PurlError), empty-message Error, null,
undefined, empty string, string, number, object.
All 1783 tests pass; 100% code coverage maintained; pnpm check /
lint / type / build / tour:build all green.
0 commit comments