Skip to main content

lingxia_platform/
error.rs

1use thiserror::Error;
2
3/// Platform-specific error types
4#[derive(Error, Debug)]
5pub enum PlatformError {
6    #[error("Platform error: {0}")]
7    Platform(String),
8
9    #[error("Asset not found: {0}")]
10    AssetNotFound(String),
11
12    #[error("Invalid parameter: {0}")]
13    InvalidParameter(String),
14}
15
16/// Result type for platform operations
17pub type PlatformResult<T> = Result<T, PlatformError>;
18
19#[cfg(target_os = "android")]
20impl From<jni::errors::Error> for PlatformError {
21    fn from(value: jni::errors::Error) -> Self {
22        PlatformError::Platform(format!("JNI error: {}", value))
23    }
24}