robius_open/error.rs
1pub type Result<T> = std::result::Result<T, Error>;
2
3/// Errors encountered when opening a URI.
4#[derive(Debug)]
5pub enum Error {
6 /// Could not acquire the android environment.
7 ///
8 /// See the `android-env` crate for more details.
9 AndroidEnvironment,
10 #[cfg(target_os = "android")]
11 Java(jni::errors::Error),
12 /// The provided URI was malformed.
13 MalformedUri,
14 /// No handler was available to open the URI.
15 NoHandler,
16 /// An unknown error occurred.
17 ///
18 /// Note that on certain platforms if a handler is not available this error
19 /// variant will be returned, as the error returned by the operating system
20 /// is not fine-grained enough.
21 Unknown,
22}
23
24#[cfg(target_os = "android")]
25impl From<jni::errors::Error> for Error {
26 fn from(value: jni::errors::Error) -> Self {
27 Self::Java(value)
28 }
29}