Enum Error
pub enum Error {
Runtime(String),
Value(String),
Assertion(String),
NotConnected,
ObjectTypeMismatch {
expected: ObjectType,
actual: ObjectType,
},
Request(Box<Error>),
WebSocket(Box<Error>),
Serde(Error),
Io(Error),
}Expand description
Errors that can occur while using the client.
The variants mirror the exceptions raised by the original Python client:
Error::Runtime corresponds to RuntimeError, Error::Value to
ValueError and Error::Assertion to AssertionError.
Variants§
Runtime(String)
A runtime error, e.g. a non-successful HTTP response or a failed check.
Value(String)
An invalid argument was provided.
Assertion(String)
An assertion about the provided arguments failed.
NotConnected
A connection based operation was attempted without an open connection.
ObjectTypeMismatch
The server returned an object whose type differs from the requested one.
Fields
expected: ObjectTypeThe object type that was requested.
actual: ObjectTypeThe object type the server actually returned.
Request(Box<Error>)
The underlying HTTP transport failed.
WebSocket(Box<Error>)
The underlying websocket transport failed.
Serde(Error)
(De)serialization of a JSON payload failed.
Io(Error)
An I/O operation (e.g. reading a model file) failed.
Implementations§
§impl Error
impl Error
pub fn runtime(message: impl Into<String>) -> Self
pub fn runtime(message: impl Into<String>) -> Self
Creates a Error::Runtime from anything string-like.
pub fn value(message: impl Into<String>) -> Self
pub fn value(message: impl Into<String>) -> Self
Creates a Error::Value from anything string-like.
pub fn assertion(message: impl Into<String>) -> Self
pub fn assertion(message: impl Into<String>) -> Self
Creates a Error::Assertion from anything string-like.
pub fn object_type_mismatch(expected: ObjectType, actual: ObjectType) -> Self
pub fn object_type_mismatch(expected: ObjectType, actual: ObjectType) -> Self
Creates an Error::ObjectTypeMismatch from the requested and actual types.