Sets SQL operation state to ERROR when exception is thrown