Skip to main content
Version: v0.0.3

Class: CcdaParseError

Thrown by parseCcda (and the secure XML substrate it calls) when the input violates one of the seven unrecoverable Tier-3 rules, a declared DTD/external entity, entity-expansion or size/depth/node-count limits, malformed XML, or a well-formed document whose root is not ClinicalDocument. Carries a PHI-free structural position; unlike some sibling parsers it does not retain a raw input snippet, precisely because C-CDA payloads are clinical documents and any snippet would risk leaking PHI.

Example

import { parseCcda, CcdaParseError } from "@cosyte/ccda";
try {
parseCcda(raw);
} catch (err) {
if (err instanceof CcdaParseError && err.code === "NOT_A_CLINICAL_DOCUMENT") {
// err.position, err.code available, no PHI in either
}
}

Extends

  • Error

Constructors

Constructor

new CcdaParseError(code, message, position): CcdaParseError

Internal

Construct a new CcdaParseError. All three fields are required so every thrower populates a code, a human-readable (PHI-free) message, and a structural position.

Parameters

code

FatalCode

message

string

position

CcdaPosition

Returns

CcdaParseError

Overrides

Error.constructor

Properties

code

readonly code: FatalCode


position

readonly position: CcdaPosition