Change cancel_query to return a Result