diff options
| author | Jamie Quigley <jamie@quigley.xyz> | 2022-12-27 12:44:00 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-27 12:44:00 +0000 |
| commit | b01d9f81b0affe4f7f6091dd5eeeab1524c0d314 (patch) | |
| tree | 18c00640c05780b06a1a9658656c80f7313dfe78 | |
| parent | Rework `atuin init` (#652) (diff) | |
| download | atuin-b01d9f81b0affe4f7f6091dd5eeeab1524c0d314.zip | |
Improve error message when $AUTIN_SESSION is not set. (#654)
Closes #653
| -rw-r--r-- | atuin-client/src/database.rs | 6 |
1 files 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(), |
