Skip to content

Commit

Permalink
Improve error message when $AUTIN_SESSION is not set. (#654)
Browse files Browse the repository at this point in the history
Closes #653
  • Loading branch information
Sciencentistguy committed Dec 27, 2022
1 parent a5616ae commit b01d9f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions atuin-client/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ pub struct Context {
}

pub fn current_context() -> Context {
let session =
env::var("ATUIN_SESSION").expect("failed to find ATUIN_SESSION - check your shell setup");
let Ok(session) = env::var("ATUIN_SESSION") else {
eprintln!("ERROR: Failed to find $ATUIN_SESSION in the environment. Check that you have correctly set up your shell.");
std::process::exit(1);
};
let hostname = format!("{}:{}", whoami::hostname(), whoami::username());
let cwd = match env::current_dir() {
Ok(dir) => dir.display().to_string(),
Expand Down

0 comments on commit b01d9f8

Please sign in to comment.