pub enum Error {
Load(LoadError),
Api {
function: &'static str,
code: StatusCode,
message: String,
causes: Vec<StatusCode>,
},
LibraryAlreadyLoaded,
InvalidArgument(String),
}Expand description
Every failure the safe API reports.
Variants§
Load(LoadError)
The C API library could not be opened or lacks symbols.
Api
A C API call returned an error result.
Fields
code: StatusCodeThe status code of the result.
causes: Vec<StatusCode>The codes of StatusCode::WRAPPED_CAUSES that the result wraps under code,
as qar_result_has_code reports them.
LibraryAlreadyLoaded
qar_library_init is process-wide; a second Library cannot coexist
with a live one.
InvalidArgument(String)
The argument cannot be passed to the C API (interior NUL, too many views, …).
Implementations§
Source§impl Error
impl Error
Sourcepub fn code(&self) -> Option<StatusCode>
pub fn code(&self) -> Option<StatusCode>
The status code of an Error::Api.
Sourcepub fn has_code(&self, expected: StatusCode) -> bool
pub fn has_code(&self, expected: StatusCode) -> bool
Whether this is an Error::Api with the expected code.
Sourcepub fn has_cause(&self, expected: StatusCode) -> bool
pub fn has_cause(&self, expected: StatusCode) -> bool
Whether the error is expected itself or wraps it as a cause, the C API’s
qar_result_has_code. Wrapped causes are known for StatusCode::WRAPPED_CAUSES only:
begin-frame reports a paused, reconnecting or transfer-less stream inside
StatusCode::RENDERING_UNABLE_TO_BEGIN_FRAME.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()