Better error handling for login failures