add failure handler

add failure handler for updating and deleting query