chiark / gitweb /
Change the message for AuthError::Nonexistent.
authorSimon Tatham <anakin@pobox.com>
Wed, 24 Jan 2024 08:48:11 +0000 (08:48 +0000)
committerSimon Tatham <anakin@pobox.com>
Wed, 24 Jan 2024 20:03:12 +0000 (20:03 +0000)
"Not logged in" used to be correct, when we didn't support account
registration. But now the auth file can _exist_ while still being
logged in. So we should be more precise in the translation of this
error code: it really means <cfgdir>/auth is absent in an ENOENT sort
of way.

However, we shouldn't normally _see_ that message: it's one of the few
error cases that we detect programmatically and divert into a handler
for (to wit, the login flow).

src/auth.rs

index e98f24c8cb45937a0f076a3cf74e6ac6b9747692..78a174dba6aac916797ed8e4d0b9b4f71454008d 100644 (file)
@@ -17,7 +17,7 @@ impl std::fmt::Display for AuthError {
     ) -> Result<(), std::fmt::Error> {
         match self {
             AuthError::Nonexistent(_) => {
-                write!(f, "not logged in")
+                write!(f, "no saved authentication file")
             }
             AuthError::Bad(ref msg) => {
                 write!(f, "unable to read authentication: {}", msg)