Improve the error when failing to prompt for authentication credentials.

Review Request #12245 — Created April 20, 2022 and submitted

Information

RBTools
release-3.x

Reviewers

When attempting to request an authenticated user session,
get_authenticated_session() may need to prompt for credentials. It
checks if stdin 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.

Summary ID
Improve the error when failing to prompt for authentication credentials.
When attempting to request an authenticated user session, `get_authenticated_session()` may need to prompt for credentials. It checks if `stdin` 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.
c7f78ff8146ea6c3c633e29a31fe512aa8ddd2ed
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.x (ddb2c60)