Skip to content

Documentation / @facturometro/einvoice / DocumentKindError

Class: DocumentKindError ​

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

A UBL document of the wrong kind was passed to a kind-specific entry point.

Thrown for example by parseInvoice() when the root element is a CreditNote.

Example ​

ts
import { DocumentKindError } from '@facturometro/core';

throw new DocumentKindError({ actual: 'creditNote', expected: 'invoice' });

Extends ​

Constructors ​

Constructor ​

new DocumentKindError(kinds, options?): DocumentKindError

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

Creates a document kind error.

Parameters ​

kinds ​

The document kinds involved in the mismatch.

actual ​

string

The document kind that was found.

expected ​

string

The document kind the caller asked for.

options? ​

ErrorOptions

Standard error options, in particular cause.

Returns ​

DocumentKindError

Overrides ​

EInvoiceError.constructor

Properties ​

actual ​

readonly actual: string

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

The document kind that was found, for example creditNote.


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-DOCUMENT-KIND"

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

Stable, machine-readable identifier of the failure.

Overrides ​

EInvoiceError.code


expected ​

readonly expected: string

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

The document kind the caller asked for, for example invoice.


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


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.