login and register error handler