ailloli_ui_openxr/
error.rs

1//! Host-adapter errors shared by generic frame and input bridges.
2
3use thiserror::Error;
4
5/// Shared result alias for host-side XR adapters.
6///
7/// # Examples
8///
9/// ```
10/// use ailloli_ui_openxr::{OpenXrHostError, OpenXrHostResult};
11///
12/// let result: OpenXrHostResult<()> = Err(OpenXrHostError::Unsupported("hand tracking".into()));
13/// assert!(matches!(result, Err(OpenXrHostError::Unsupported(_))));
14/// ```
15pub type OpenXrHostResult<T> = Result<T, OpenXrHostError>;
16
17/// Errors produced by `ailloli_ui_openxr` host adapters.
18///
19/// The contained string preserves backend or callback context and is included
20/// in the human-readable error message.
21///
22/// # Examples
23///
24/// ```
25/// use ailloli_ui_openxr::OpenXrHostError;
26///
27/// let error = OpenXrHostError::PresentFailed("queue closed".into());
28/// assert_eq!(error.to_string(), "openxr host: swapchain present failed: queue closed");
29/// ```
30#[derive(Debug, Error)]
31pub enum OpenXrHostError {
32    /// Source failed to provide a writable texture for rendering.
33    #[error("openxr host: frame source unavailable: {0}")]
34    FrameSourceUnavailable(String),
35    /// Host-side submit/present of the rendered frame failed.
36    #[error("openxr host: swapchain present failed: {0}")]
37    PresentFailed(String),
38    /// Input conversion failed (invalid geometry or inconsistent source state).
39    #[error("openxr host: input conversion failed: {0}")]
40    InputConversionFailed(String),
41    /// Unsupported backend feature combination.
42    #[error("openxr host: unsupported configuration ({0})")]
43    Unsupported(String),
44    /// Generic callback failure (used by mock and callback sources).
45    #[error("openxr host: callback failed: {0}")]
46    CallbackFailed(String),
47}