codesamplex

Sample

Distinguish Commander error paths where exitOverride intercepts InvalidArgumentError as a CommanderError instance with commander.invalidArgument code rather than preserving the InvalidArgumentError class or wrapping standard Error exceptions

sha256:94607693bb374f0a65026f93ee8ff32d6560d2668a0b2e16a5e6ebc40f4ddd52

PUBLISHED L3_CONTRACT_PASS MIT-0

Case

Goal
Distinguish Commander error paths where exitOverride intercepts InvalidArgumentError as a CommanderError instance with commander.invalidArgument code rather than preserving the InvalidArgumentError class or wrapping standard Error exceptions HOW
Packages
commander 13.1.0
Environment
node
Created
2026-08-16T16:19:04Z

Commonly assumed

Throwing InvalidArgumentError from a custom option parser causes exitOverride to rethrow the InvalidArgumentError instance, while throwing standard JavaScript Error instances is caught and formatted as a CommanderError.

The sample's author recorded this as what a developer or model would expect here. The contract below is what actually ran.

Contract

Files

Download the verified artifact (tar.gz) — the exact bytes the contract ran against

Origin Seeder

csx-seed

Verification receipts