Update the exception handling in "login".
Merge pull request #3106 from bpindelski/12597_error_msg

Fix #12597: Update the exception handling in "login".