#[non_exhaustive]pub enum LAError {
Show 19 variants
InvalidArgument(String),
TimedOut(String),
BridgeFailed(String),
AuthenticationFailed(String),
UserCancel(String),
UserFallback(String),
SystemCancel(String),
PasscodeNotSet(String),
BiometryNotAvailable(String),
BiometryNotEnrolled(String),
BiometryLockout(String),
AppCancel(String),
InvalidContext(String),
NotInteractive(String),
CompanionNotAvailable(String),
BiometryNotPaired(String),
BiometryDisconnected(String),
InvalidDimensions(String),
Other {
code: i32,
message: String,
},
}Expand description
Top-level error type returned by this crate.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidArgument(String)
Invalid input crossed the FFI boundary.
TimedOut(String)
The framework callback did not complete before the bridge timeout elapsed.
BridgeFailed(String)
The Swift bridge failed before reaching the framework call.
AuthenticationFailed(String)
Authentication was not successful because valid credentials were not provided.
UserCancel(String)
Authentication was cancelled by the user.
UserFallback(String)
Authentication was cancelled because the fallback button was tapped.
SystemCancel(String)
Authentication was cancelled by the system.
PasscodeNotSet(String)
Authentication cannot start because no device passcode is configured.
BiometryNotAvailable(String)
Authentication cannot start because biometry is unavailable.
BiometryNotEnrolled(String)
Authentication cannot start because no biometric identities are enrolled.
BiometryLockout(String)
Authentication cannot start because biometry is locked.
AppCancel(String)
Authentication was cancelled by the application.
InvalidContext(String)
The LAContext has already been invalidated.
NotInteractive(String)
Authentication would require UI while interaction is disallowed.
CompanionNotAvailable(String)
Authentication cannot start because no companion device is nearby.
BiometryNotPaired(String)
Authentication cannot start because the paired biometric accessory is unavailable.
BiometryDisconnected(String)
Authentication cannot start because the paired biometric accessory is disconnected.
InvalidDimensions(String)
Authentication cannot start because an embedded UI size is invalid.
Other
Catch-all for unmapped framework or bridge status codes.
Implementations§
Source§impl LAError
impl LAError
Sourcepub const fn code(&self) -> i32
pub const fn code(&self) -> i32
Numeric bridge, LAError, or OSStatus code reported by the bridge.
Sourcepub fn from_code_message(code: i32, message: impl Into<String>) -> Self
pub fn from_code_message(code: i32, message: impl Into<String>) -> Self
Build an error value from a numeric code and message.
Examples found in repository?
4fn main() {
5 let errors = [
6 LAError::from_code_message(ffi::la_error::BIOMETRY_LOCKOUT, "biometry locked"),
7 LAError::from_code_message(ffi::la_error::COMPANION_NOT_AVAILABLE, "companion missing"),
8 LAError::from_code_message(ffi::status::BRIDGE_FAILED, "bridge failed"),
9 ];
10
11 println!("domain: {LA_ERROR_DOMAIN}");
12 for error in errors {
13 println!("{error:?} => {error}");
14 }
15 println!("✅ error mapping OK");
16}Trait Implementations§
Source§impl Error for LAError
impl Error for LAError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()