Skip to content

Commit

Permalink
Improve error when we can't find a time zone
Browse files Browse the repository at this point in the history
  • Loading branch information
ogham committed Feb 11, 2016
1 parent 767d9fc commit 252eba4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/output/details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,21 @@ pub struct Environment<U: Users+Groups> {

impl Default for Environment<UsersCache> {
fn default() -> Self {
use std::process::exit;

let tz = match determine_time_zone() {
Ok(tz) => tz,
Err(e) => {
println!("Unable to determine time zone: {}", e);
exit(1);
},
};

Environment {
current_year: LocalDateTime::now().year(),
numeric: locale::Numeric::load_user_locale().unwrap_or_else(|_| locale::Numeric::english()),
time: locale::Time::load_user_locale().unwrap_or_else(|_| locale::Time::english()),
tz: determine_time_zone().expect("Unable to determine time zone"),
tz: tz,
users: Mutex::new(UsersCache::new()),
}
}
Expand Down

0 comments on commit 252eba4

Please sign in to comment.