Improve the error when failing to prompt for authentication credentials.
Review Request #12245 — Created April 20, 2022 and submitted — Latest diff uploaded
When attempting to request an authenticated user session,
get_authenticated_session()
may need to prompt for credentials. It
checks ifstdin
is a TTY before doing this, and if not, it attempts to
provide an error.In practice, this originally led to a crash in
APIError
string
building, which has been fixed in /r/12244/. This change further refines
this reworking the error message to be a bit more friendly and helpful,
less technical, and to place that error in the exception rather than the
log output.Unfortunately, this error (and authentication prompt logic) exists in
two places:get_authenticated_session()
and
Command.credentials_prompt()
. Both have been updated, but this change
isn't going to tackle consolidating these code paths.
Triggered this code path and saw a more helpful error message, without a
crash.Tested the Win32 and non-Win32 versions of this message.