#[non_exhaustive]pub enum Error {
NoLicense,
UnknownLicenseType {
bits: i32,
},
RecursionLimit {
path: String,
limit: usize,
},
Engine {
code: i32,
dispid: i32,
},
Com {
hresult: i32,
dispid: i32,
},
UnexpectedType {
expected: &'static str,
actual: &'static str,
},
}Expand description
An error from a TestStand™ COM operation.
Every fallible member of the public API returns Result<_, Error> (i.e.
rs_teststand::Error). Library code never panics; failures always arrive
here.
Engine failures are reported by name where the engine defines one, so a caller is not left decoding a bare number:
use rs_teststand::Error;
// `dispid` names the member that failed; 0 means the failure came from
// outside a member call.
let out_of_memory = Error::Engine { code: -17000, dispid: 0 };
assert_eq!(out_of_memory.code_name(), Some("TS_Err_OutOfMemory"));
assert!(out_of_memory.to_string().contains("TS_Err_OutOfMemory"));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NoLicense
The station holds no license.
Raised by Engine::require_license,
not by the engine, so that “unlicensed” is reported once and up front
rather than as whatever operation later happened to need a license.
UnknownLicenseType
The engine named a license value this build does not know.
A newer engine may define one this crate predates. The number is carried through rather than mapped onto a near neighbour.
RecursionLimit
A property tree was walked deeper than the caller allowed.
Usually a cycle rather than genuine depth. A live SequenceContext
lists ThisContext among its own sub-properties, so it contains itself,
and a walk with no limit recurses until the stack is gone. path is
where the limit was reached, which is normally enough to see the loop.
Fields
Engine
The engine raised a failure it has a name for.
code is the engine’s own error code, taken from the raised exception
rather than the generic COM DISP_E_EXCEPTION wrapper.
Fields
Com
A COM call failed with a code the engine does not name, a standard
Windows HRESULT, or a code newer than the generated table.
UnexpectedType
A returned value was not the type the wrapper expected, an internal mismatch between the wrapper and the live object model.
Implementations§
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()