Skip to main content

blinc_platform/
error.rs

1//! Platform error types
2
3use thiserror::Error;
4
5/// Platform-related errors
6#[derive(Error, Debug)]
7pub enum PlatformError {
8    /// Failed to initialize platform
9    #[error("Platform initialization failed: {0}")]
10    InitFailed(String),
11
12    /// Failed to create event loop
13    #[error("Failed to create event loop: {0}")]
14    EventLoop(String),
15
16    /// Failed to create window
17    #[error("Failed to create window: {0}")]
18    WindowCreation(String),
19
20    /// Platform not available
21    #[error("Platform not available: {0}")]
22    Unavailable(String),
23
24    /// Platform not supported on this OS
25    #[error("Platform not supported: {0}")]
26    Unsupported(String),
27
28    /// Generic platform error
29    #[error("Platform error: {0}")]
30    Other(String),
31
32    /// Failed to load asset
33    #[error("Asset load failed: {0}")]
34    AssetLoad(String),
35}
36
37/// Result type for platform operations
38pub type Result<T> = std::result::Result<T, PlatformError>;