From b01d9f81b0affe4f7f6091dd5eeeab1524c0d314 Mon Sep 17 00:00:00 2001 From: Jamie Quigley Date: Tue, 27 Dec 2022 12:44:00 +0000 Subject: [PATCH] Improve error message when $AUTIN_SESSION is not set. (#654) Closes #653 --- atuin-client/src/database.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/atuin-client/src/database.rs b/atuin-client/src/database.rs index e1b58e03..874c4407 100644 --- a/atuin-client/src/database.rs +++ b/atuin-client/src/database.rs @@ -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(),