Codify dialog exit statuses and make them less error-prone

This commit is contained in:
2022-05-30 17:47:56 -07:00
parent 762fdc3912
commit 32cb674e7a
2 changed files with 31 additions and 15 deletions

View File

@ -6,6 +6,22 @@ pub mod settings;
pub const BSCREENSAVER_WM_CLASS: &[u8] = b"bscreensaver\0Bscreensaver\0";
#[repr(i32)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum DialogExitStatus {
AuthFailed = -1,
AuthSucceeded = 0,
AuthCanceled = 1,
AuthTimedOut = 2,
OtherError = 3,
}
impl DialogExitStatus {
pub fn exit(&self) -> ! {
std::process::exit(*self as i32);
}
}
pub fn init_logging(env_name: &str) {
env_logger::builder()
.format_timestamp_millis()