#[non_exhaustive]pub enum GenApiError {
Show 31 variants
NodeNotFound(String),
Type {
name: String,
kind: &'static str,
expected: &'static str,
},
Access {
name: String,
refused: AccessDirection,
},
Locked {
name: String,
locked_by: String,
},
InvalidText {
name: String,
expected: &'static str,
text: String,
},
Range {
name: String,
value: Value,
violation: RangeViolation,
},
RegisterLength {
name: String,
len: u32,
got: usize,
},
Unavailable(String),
NoValueSource {
name: String,
},
NoIndexedValue {
name: String,
index_node: String,
index: i64,
},
Io(Box<dyn Error + Send + Sync + 'static>),
RegisterEncoding {
name: String,
width: usize,
problem: &'static str,
},
Declaration {
name: String,
problem: &'static str,
},
Unsupported {
name: String,
kind: &'static str,
},
ExprParse {
name: String,
formula: String,
source: ParseError,
},
ExprEval {
name: String,
source: EvalError,
},
UnknownVariable {
name: String,
var: String,
},
UnknownVariableExtension {
name: String,
var: String,
extension: String,
},
EnumValueUnknown {
node: String,
value: i64,
},
EnumEntryUnavailable {
node: String,
entry: String,
},
EnumNoSuchEntry {
node: String,
entry: String,
},
NotAttached {
node: String,
port: String,
},
PortNotWritable {
node: String,
port: String,
},
UnknownPort {
node: String,
port: String,
},
NotDeviceMemory {
node: String,
port: String,
},
PortOutOfRange {
node: String,
port: String,
offset: i64,
len: u32,
size: usize,
},
BadIndirectAddress {
name: String,
addr: i64,
},
BadLength {
name: String,
length_node: String,
len: i64,
},
BitfieldOutOfRange {
name: String,
bit_offset: u16,
bit_length: u16,
len: usize,
},
ValueTooWide {
name: String,
value: i64,
bit_length: u16,
},
MaskedWriteUnreadable {
name: String,
address: u64,
},
}Expand description
Error type produced by GenApi operations.
Every variant names the node it is about. A transport’s failure is the
source of GenApiError::Io, and a
formula’s of GenApiError::ExprParse and GenApiError::ExprEval:
carried, never flattened into text (ADR-0030).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NodeNotFound(String)
The requested node does not exist in the nodemap.
Type
The node is of another kind than the operation needs.
Fields
kind: &'static strIts kind, as crate::Node::kind_name names it.
Access
The node’s access mode forbids the operation: a read of a WO node, a
write of an RO one.
Locked
The node declares pIsLocked and the device currently reports it
locked, so the write was refused locally.
Names the locking feature, because that is the actionable part: a
caller told only “access denied” has nowhere to go, whereas
“ExposureTime is locked by ExposureTime_Lck” points at the feature
to change first. See ADR-0018 and backlog GA-06.
Fields
InvalidText
Text given for a feature does not parse as the feature’s type: see
crate::NodeMap::set_text. Nothing was written.
Fields
Range
The value is outside what the node accepts. Nothing was written.
Fields
violation: RangeViolationHow it falls outside.
RegisterLength
Bytes written to a <Register> are not its length. Nothing was
written.
The node is currently not available: its pIsAvailable reads false.
NoValueSource
The node has no value of its own to read or write: no register, no
<pValue> and no <Value>.
NoIndexedValue
An indexed <Integer> or <Float> has no value for the index its
<pIndex> node reads now: no <ValueIndexed> or <pValueIndexed>
names it, and there is no <ValueDefault> or <pValueDefault>
(GenICam Standard v2.1.1 §2.8.5). Nothing was read or written.
Fields
Io(Box<dyn Error + Send + Sync + 'static>)
Register I/O failed in the transport. The source is the transport’s error: a GVCP status, a USB failure, a timeout.
RegisterEncoding
A register’s bytes cannot be converted to or from the node’s value: an
empty payload, a width its encoding has no form for (an IEEE float of
three bytes), an unsigned bit field beyond i64.
The bytes are the device’s, or the width the node declares; the XML itself parsed (backlog GA-30).
Fields
Declaration
The node’s declaration cannot be evaluated: the XML loaded, but
declares something a node of its kind cannot have, such as a
<Boolean> over a register with no bit field, or a zero scale.
Fields
Unsupported
A declaration this crate has no builder for.
viva_genapi_xml::NodeDecl is #[non_exhaustive], so a node type
added to the XML layer no longer breaks this crate’s build. It
surfaces here instead, at nodemap construction, and lands in
crate::NodeMap::skipped where the corpus test will see it.
Fields
kind: &'static strThe declaration’s kind, as viva_genapi_xml::NodeDecl::kind
names it.
ExprParse
Parsing a formula failed.
Fields
source: ParseErrorThe parser’s error, with the offset into formula.
ExprEval
Evaluating a formula failed.
Fields
UnknownVariable
A formula referenced an unknown variable.
UnknownVariableExtension
A formula qualified a <pVariable> with an extension the GenApi
standard does not define — anything but .Value, .Min, .Max,
.Inc or .Entry.<Name>.
Fields
EnumValueUnknown
Raw register value did not correspond to any enum entry.
The enumeration entry exists but cannot be selected now: its
pIsImplemented or pIsAvailable reads false. Nothing was written.
EnumNoSuchEntry
Attempted to select an enum entry that does not exist.
NotAttached
The node reads a chunk or event port, and nothing is attached to it.
A chunk port’s registers address one chunk of a stream buffer, an
event port’s one event (GenICam Standard v2.1.1 §2.8.16): there is no
device memory behind them to fall back on. Attach a frame’s chunks or a
received event first (crate::NodeMap::attach_chunks,
crate::NodeMap::attach_event).
PortNotWritable
The node is on a chunk or event port, which holds data the camera sent and cannot be written.
UnknownPort
The register is on a port the document does not declare, so there is nowhere to read it from.
NotDeviceMemory
A device address was asked of a register on a chunk or event port,
whose address counts from the start of a chunk or an event, not from
device memory: see crate::NodeMap::register_address.
PortOutOfRange
The register lies outside the chunk or event data attached to its port.
Fields
BadIndirectAddress
Indirect addressing resolved to an invalid register.
BadLength
A <pLength> node reads a length no register can have: negative,
beyond u32, or, for device memory, beyond 16 MiB. Nothing was read
or written.
Fields
BitfieldOutOfRange
Bitfield metadata exceeded the backing register width.
Fields
ValueTooWide
Provided value does not fit into the declared bitfield.
MaskedWriteUnreadable
A bitfield write needs the rest of its register, and the register is write-only with nothing cached.
Writing some bits of a register means sending the whole register, so
the other bits have to come from somewhere. For a WO register they
cannot come from the device — it refuses the read — and inventing them
would silently overwrite whatever the device holds. Refused locally,
before anything reaches the wire (backlog GA-31, issue #135).
Implementations§
Source§impl GenApiError
impl GenApiError
Sourcepub fn io(err: impl Into<Box<dyn Error + Send + Sync + 'static>>) -> Self
pub fn io(err: impl Into<Box<dyn Error + Send + Sync + 'static>>) -> Self
A transport’s failure: err becomes the GenApiError::Io source.
For RegisterIo implementations, so the error a
caller sees can be downcast to the transport’s own.
Trait Implementations§
Source§impl Debug for GenApiError
impl Debug for GenApiError
Source§impl Display for GenApiError
impl Display for GenApiError
Source§impl Error for GenApiError
impl Error for GenApiError
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()