Class: CcdaProfileDefinitionError
Thrown by defineCcdaProfile when a profile definition is structurally
invalid, a missing/empty name, an unknown option key, a tolerate entry
whose code is not a real WarningCode, a missing rationale, or,
the load-bearing safety rule, an attempt to tolerate a safety-critical
warning code. Distinct from CcdaParseError (which is about a
document): this is about a malformed profile, so it is never part of the
lenient parse path and carries no CcdaPosition.
Example
import { defineCcdaProfile, CcdaProfileDefinitionError } from "@cosyte/ccda";
try {
defineCcdaProfile({ name: "bad", tolerate: [{ code: "MISSING_DOSE_QUANTITY", rationale: "x" }] });
} catch (err) {
if (err instanceof CcdaProfileDefinitionError) {
// a profile may never tolerate a safety-critical code
}
}
Extends
Error
Constructors
Constructor
new CcdaProfileDefinitionError(
message,profileName?):CcdaProfileDefinitionError
Internal
Construct a new CcdaProfileDefinitionError.
Parameters
message
string
profileName?
string
Returns
CcdaProfileDefinitionError
Overrides
Error.constructor
Properties
profileName
readonlyprofileName:string|undefined
The offending profile's name, when known at throw time.