All PiMath errors extend PiMathError, so a consumer can catch every
library error at once with catch (e) { if (e instanceof PiMathError) ... },
or discriminate a specific kind with instanceof ParseError, etc.
The original error (e.g. piexpression's ParseError) is chained through the
standard ES2022 cause option.
Typed error hierarchy for PiMath.
All PiMath errors extend PiMathError, so a consumer can catch every library error at once with
catch (e) { if (e instanceof PiMathError) ... }, or discriminate a specific kind withinstanceof ParseError, etc.The original error (e.g. piexpression's ParseError) is chained through the standard ES2022
causeoption.