unacy / UnacyError
Class: UnacyError
Defined in: packages/core/src/errors.ts:25
Base error class for all unacy errors.
Remarks
All unacy-specific errors extend UnacyError, so callers can catch the entire error family with a single catch (e) { if (e instanceof UnacyError) ... } guard while still discriminating by subclass when needed.
Object.setPrototypeOf is called in the constructor to maintain a correct prototype chain in environments that compile to ES5.
Example
typescript
try {
registry.convert(value, 'Celsius').to('Kelvin');
} catch (e) {
if (e instanceof UnacyError) {
console.error('Unit conversion failed:', e.message);
}
}Extends
Error
Extended by
Constructors
Constructor
ts
new UnacyError(message): UnacyError;Defined in: packages/core/src/errors.ts:26
Parameters
| Parameter | Type |
|---|---|
message | string |
Returns
UnacyError
Overrides
ts
Error.constructor