Better error handling during login