pub enum EditError {
InvalidFieldName(String),
UnknownField(String),
InvalidKindName(String),
ReservedKind,
IndexOutOfRange {
index: usize,
len: usize,
},
ValueTooDeep {
max: usize,
},
Import(ImportError),
FieldRichtextDecode {
field: String,
message: String,
},
FieldRichtextNotInline(String),
FieldConform {
field: String,
message: String,
},
ContentApply(ApplyError),
}Expand description
Errors returned by document and card mutators.
Variants§
InvalidFieldName(String)
UnknownField(String)
A typed write (TypedWriter::set /
CardWriter::set) addressed a well-formed name
that the bound schema does not declare (or a card whose $kind carries
no schema). The typed path resolves every name to a schema type, so an
undeclared name is a typo, not a fallback — it fails here instead of
landing silently in the opaque store. Reach for the raw
Card::store_field when opaque storage is the intent.
InvalidKindName(String)
ReservedKind
IndexOutOfRange
ValueTooDeep
Import(ImportError)
Markdown import failed — the content codec rejected the input for a body
or a field path (e.g. container nesting past
MAX_NESTING_DEPTH). Returned
instead of silently degrading the target to empty on a rejected import.
FieldRichtextDecode
A richtext field value in the content-or-markdown encoding could not be
decoded: a JSON object that is not a canonical richtext content, a
markdown string that failed to import, or a shape that is neither
object, string, nor null. Returned by
Card::commit_field on a richtext field, by
Card::revise_field on a present non-content field,
and by Card::apply_field_richtext_change.
FieldRichtextNotInline(String)
A richtext field written under the richtext(inline) constraint decoded
to a multi-block content (more than one line, a container, or an island).
The write-time counterpart of the coercion/validation richtext(inline)
check; returned by Card::commit_field when the
field’s schema is richtext with inline: true.
FieldConform
A typed write (Card::commit_field) could not
conform the value to the field’s schema type — the general write-commit
failure for scalar/array/object types (a "x" for an integer, a
non-object for an object, …). Richtext fields report through the
dedicated FieldRichtextDecode /
FieldRichtextNotInline variants
instead, so the richtext write surface is unchanged.
ContentApply(ApplyError)
A content field-change bundle (text delta, line ops, mark ops) applied out of bounds or broke an invariant normalization could not repair.
Implementations§
Trait Implementations§
Source§impl Error for EditError
impl Error for EditError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()