# How treat errors in tasks

**URL:** <https://forum.ansible.com/t/how-treat-errors-in-tasks/34025>\
**Category:** Ansible Project\
**Created:** [October 13, 2020, 9:26pm UTC](https://forum.ansible.com/t/how-treat-errors-in-tasks/34025 "2020-10-13T21:26:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafael\_Tomelin](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rafael\_Tomelin](https://forum.ansible.com/u/Rafael_Tomelin)\
**Post date:** [October 13, 2020, 9:26pm UTC](https://forum.ansible.com/t/how-treat-errors-in-tasks/34025/1 "2020-10-13T21:26:14Z")

</div>

Hi,

I have the function that creates a database and after creating the DB I inserted the access information in a VAULT, the problem that sometimes inconsistent information is passed and the database creation TASK returns an error.

I would like to know if when I have an error before canceling the execution I call another task or via callback call a previous task?

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [October 13, 2020, 9:40pm UTC](https://forum.ansible.com/t/how-treat-errors-in-tasks/34025/2 "2020-10-13T21:40:21Z")

</div>

I would register the result of that task and use that to decide what to do next.  
Also use failed\_when later to override what is really a failure.
