Skip to main content

Module error

Module error 

Source
Expand description

Errors.

§The rule that shapes every message in this module

An error must not echo the value that failed (X11.7). openEHR instances carry protected health information, and an error message is the one place a value escapes into a log, an API response, and a support ticket simultaneously — three retention policies, none of them the record’s.

So the messages here name the path and the rule, never the content:

good:  invariant violated at /content[0]/data/events[0]/data/items[1]: Element.is_null
bad:   invariant violated: value "Systolic 184 mmHg" is not null but null_flavour is set

The one deliberate exception is ParseError, which reports failures in identifiers and type codesat0004, openEHR-EHR-OBSERVATION.x.v1, SNOMED-CT. Those are design-time vocabulary, not patient content, and an identifier error that will not say which identifier is unactionable. Even there the value is truncated (ParseError::MAX_ECHO) so that a caller who passes a whole document into a parser by mistake does not log the document.

Structs§

ParseError
A lexical form did not match the grammar its type requires.
ValidationReport
Every invariant that failed, not just the first.
Violation
A single failed invariant.

Enums§

Error
The crate-wide error type.
PathError
A path expression failed to resolve.

Type Aliases§

Result
The crate’s result alias.