From 7aaa44c9acd69072a345230e7bacc9d9b182b13d Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Mon, 16 Oct 2023 13:42:27 -0700 Subject: [PATCH] Friendlier error for file-not-found --- src/cli/cmd/status/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cli/cmd/status/mod.rs b/src/cli/cmd/status/mod.rs index 134afaec..5c16393e 100644 --- a/src/cli/cmd/status/mod.rs +++ b/src/cli/cmd/status/mod.rs @@ -62,7 +62,14 @@ pub(crate) async fn get_status_from_auth_file( api_addr: url::Url, ) -> color_eyre::Result { let auth_token_path = crate::cli::cmd::login::auth_token_path()?; - let token = tokio::fs::read_to_string(auth_token_path).await?; + let token = tokio::fs::read_to_string(&auth_token_path) + .await + .wrap_err_with(|| { + format!( + "Could not open {}; have you run `fh login`?", + auth_token_path.display() + ) + })?; let token = token.trim(); get_status_from_auth_token(api_addr, token).await