make a handle_user_errors function