Documentation / @facturometro/einvoice / ValidationError
Class: ValidationError ​
Defined in: packages/core/src/errors.ts:271
A document did not pass validation.
Thrown only by assertValid(); validate() returns the issues instead.
Example ​
import { ValidationError } from '@facturometro/core';
try {
assertValid(invoice);
} catch (error) {
if (error instanceof ValidationError) console.error(error.issues.length);
}Extends ​
Constructors ​
Constructor ​
new ValidationError(
issues,ruleset,options?):ValidationError
Defined in: packages/core/src/errors.ts:287
Creates a validation error summarising the fatal issues.
Parameters ​
issues ​
readonly Issue[]
Every issue found, warnings included. Copied, not kept by reference.
ruleset ​
The ruleset the document was validated against.
options? ​
ErrorOptions
Standard error options, in particular cause.
Returns ​
ValidationError
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-VALIDATION"
Defined in: packages/core/src/errors.ts:272
Stable, machine-readable identifier of the failure.
Overrides ​
issues ​
readonlyissues: readonlyIssue[]
Defined in: packages/core/src/errors.ts:275
Every issue found, warnings included. A copy, so the caller cannot change it afterwards.
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 ​
ruleset ​
readonlyruleset:RulesetInfo
Defined in: packages/core/src/errors.ts:278
The ruleset the document was validated against.
stack? ​
optionalstack?:string
Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076