Documentation / @facturometro/core / InvalidDecimalError
Class: InvalidDecimalError ​
Defined in: packages/core/src/errors.ts:199
A value could not be read as a decimal number.
Thrown by Decimal.from(); parsing document content uses Decimal.parse(), which reports a lexically invalid value as an issue instead of throwing.
Example ​
import { Decimal, InvalidDecimalError } from '@facturometro/core';
try {
Decimal.from('1e3');
} catch (error) {
if (error instanceof InvalidDecimalError) console.error(error.input); // '1e3'
}Extends ​
Constructors ​
Constructor ​
new InvalidDecimalError(
input,options?):InvalidDecimalError
Defined in: packages/core/src/errors.ts:211
Creates an invalid decimal error.
Parameters ​
input ​
string
The value that is not a lexical XSD decimal.
options? ​
ErrorOptions
Standard error options, in particular cause.
Returns ​
InvalidDecimalError
Overrides ​
Properties ​
cause? ​
optionalcause?:unknown
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
Inherited from ​
code ​
readonlycode:"EINV-INVALID-DECIMAL"
Defined in: packages/core/src/errors.ts:200
Stable, machine-readable identifier of the failure.
Overrides ​
input ​
readonlyinput:string
Defined in: packages/core/src/errors.ts:203
The rejected value, as it was supplied.
message ​
message:
string
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
Inherited from ​
name ​
name:
string
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
Inherited from ​
stack? ​
optionalstack?:string
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076