Skip to content

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 ​

ts
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 ​

RulesetInfo

The ruleset the document was validated against.

options? ​

ErrorOptions

Standard error options, in particular cause.

Returns ​

ValidationError

Overrides ​

EInvoiceError.constructor

Properties ​

cause? ​

optional cause?: unknown

Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24

Inherited from ​

EInvoiceError.cause


code ​

readonly code: "EINV-VALIDATION"

Defined in: packages/core/src/errors.ts:272

Stable, machine-readable identifier of the failure.

Overrides ​

EInvoiceError.code


issues ​

readonly issues: readonly Issue[]

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 ​

EInvoiceError.message


name ​

name: string

Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074

Inherited from ​

EInvoiceError.name


ruleset ​

readonly ruleset: RulesetInfo

Defined in: packages/core/src/errors.ts:278

The ruleset the document was validated against.


stack? ​

optional stack?: string

Defined in: node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from ​

EInvoiceError.stack

MIT licensed. Specification artefacts belong to OpenPEPPOL, CEN and OASIS.