Documentation / @facturometro/core / 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 ​
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 ​
Properties ​
actual ​
readonlyactual:string
Defined in: packages/core/src/errors.ts:155
The document kind that was found, for example creditNote.
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-DOCUMENT-KIND"
Defined in: packages/core/src/errors.ts:157
Stable, machine-readable identifier of the failure.
Overrides ​
expected ​
readonlyexpected: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 ​
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