Error catching for login and register classes