Class: CcdaEditError
The typed error editCcda throws when an edit cannot be applied safely
, a hand-constructed source with no XML to edit, a structured-body-less
document, an add/replace precondition violation, an edit that would drop a
per-document-type SHALL required section, or a revision of a source whose
ClinicalDocument.id is absent or marked nullFlavor (the RPLC link has no
prior version it can truthfully name). Consumers narrow via code.
Example
import { editCcda, CcdaEditError } from "@cosyte/ccda";
try {
editCcda(doc, { sections: [{ kind: "problems", mode: "add", content: [] }] });
} catch (err) {
if (err instanceof CcdaEditError && err.code === "SECTION_ALREADY_PRESENT") {
// the document already has a Problems section, use "replace" or "upsert"
}
}
Extends
Error
Constructors
Constructor
new CcdaEditError(
code,message):CcdaEditError
Internal
Construct a new CcdaEditError.
Parameters
code
The stable failure code.
message
string
A human-readable, PHI-free explanation.
Returns
CcdaEditError
Overrides
Error.constructor
Properties
code
readonlycode:CcdaEditErrorCode
The stable CcdaEditErrorCode discriminant.