When failed a query, set history to 'error' status'