Modify error handling during login (see #10011)

Modify the error handling during the login attempt 
see https://trac.openmicroscopy.org.uk/ome/ticket/10011