# RFC: handling errors easier

**URL:** <https://forum.ansible.com/t/rfc-handling-errors-easier/17057>\
**Category:** Ansible Developer\
**Created:** [December 15, 2014, 9:45am UTC](https://forum.ansible.com/t/rfc-handling-errors-easier/17057 "2014-12-15T09:45:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rene\_Moser](https://avatars.discourse-cdn.com/v4/letter/r/7bcc69/32.png) [@Rene\_Moser](https://forum.ansible.com/u/Rene_Moser)\
**Post date:** [December 15, 2014, 9:45am UTC](https://forum.ansible.com/t/rfc-handling-errors-easier/17057/1 "2014-12-15T09:45:14Z")

</div>

Hi

I am missing a way to handling errors easily in Ansible. What do you think about implementing an error handling mechanism for failed task.

One solution which would fit my needs:

tasks:

- command: /bin/false  
notify\_failed:
- revert to snapshot
- inform users

handlers:

- revert to snapshot  
command: …

- inform users  
command: …

this would call the handler right after the error.

tasks:

- command: /bin/false  
ingore\_errors: yes  
notify\_failed: trigger error on monitoring

- command: cleanup

handlers:

- revert to snapshot  
command: …

this would call the handler at the end together will all other handlers.

Opinions?

Regards  
René

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [December 15, 2014, 11:39am UTC](https://forum.ansible.com/t/rfc-handling-errors-easier/17057/2 "2014-12-15T11:39:19Z")

</div>

There’s been quite a few discussions about the blocks proposal in the v2/ codetree, which is in progress, that will allow for error resolution in a try/except type way (that will be more immediate than handlers, too, which is a plus).

Stay tuned!
