lingxia_platform/
error.rs1use thiserror::Error;
2
3#[derive(Error, Debug)]
5pub enum PlatformError {
6 #[error("Platform error: {0}")]
7 Platform(String),
8
9 #[error("Not supported: {0}")]
10 NotSupported(String),
11
12 #[error("Asset not found: {0}")]
13 AssetNotFound(String),
14
15 #[error("Invalid parameter: {0}")]
16 InvalidParameter(String),
17
18 #[error("Business error: code {0}")]
19 BusinessError(u32),
20
21 #[error("Callback dropped")]
22 CallbackDropped,
23}
24
25pub type PlatformResult<T> = Result<T, PlatformError>;
27
28#[cfg(target_os = "android")]
29impl From<jni::errors::Error> for PlatformError {
30 fn from(value: jni::errors::Error) -> Self {
31 PlatformError::Platform(format!("JNI error: {}", value))
32 }
33}