#[non_exhaustive]pub enum DomError {
InvalidNode(NodeId),
HierarchyRequest,
NotFound,
WrongNodeType {
expected: &'static str,
got: NodeType,
},
InvalidOffset {
node: NodeId,
offset: usize,
},
InvalidState(&'static str),
Type(&'static str),
Syntax(&'static str),
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidNode(NodeId)
NodeId doesn’t exist in this arena (may have been freed).
HierarchyRequest
Would create a cycle: attempted to insert a node into its own
subtree (spec HierarchyRequestError).
NotFound
insert_before / replace_child reference child does not belong
to the target parent (spec NotFoundError).
WrongNodeType
Operation requires a specific node type — e.g. set_node_value
only works on Text and Comment nodes, not Element / Fragment.
InvalidOffset
A byte offset supplied to a text-editing operation either
overshoots the node’s data length or falls inside a multi-byte
UTF-8 codepoint (not on a char boundary). Callers should
derive offsets from Position or grapheme walks to avoid this.
InvalidState(&'static str)
The operation is not valid in the object’s current state (spec
InvalidStateError) — e.g. dispatching an Event that is
already being dispatched.
Type(&'static str)
An argument has the wrong kind — the web’s TypeError (Web IDL
§3.14.1 simple exception, not a DOMException), named without
the Error suffix like the DOMException names above
(InvalidStateError → InvalidState). E.g.
form.requestSubmit(submitter) with a submitter that is not a
submit button.
Syntax(&'static str)
A string argument does not parse (spec SyntaxError) — e.g.
el.contentEditable = "yes".
Trait Implementations§
impl Eq for DomError
Source§impl Error for DomError
impl Error for DomError
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()