improve error handling on login callback