# unable to parse uri content in a handler

**URL:** <https://forum.ansible.com/t/unable-to-parse-uri-content-in-a-handler/16220>\
**Category:** Ansible Project\
**Created:** [September 14, 2014, 6:46pm UTC](https://forum.ansible.com/t/unable-to-parse-uri-content-in-a-handler/16220 "2014-09-14T18:46:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anuj\_Agrawal](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Anuj\_Agrawal](https://forum.ansible.com/u/Anuj_Agrawal)\
**Post date:** [September 14, 2014, 6:46pm UTC](https://forum.ansible.com/t/unable-to-parse-uri-content-in-a-handler/16220/1 "2014-09-14T18:46:04Z")

</div>

I have a handler of the following form:

- name: reinit task\_handler  
uri: url=some\_url return\_content=yes  
register: webpage  
delegate\_to: localhost

Now I want to look for some string in webpage.content and mark this a pass or fail. However, I am not able to do this in any way. I tried adding a when in the handler, tried to add a notify in this handler and tried to examine webpage.content in there and a few more things.

Kindly help.

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [September 15, 2014, 8:43pm UTC](https://forum.ansible.com/t/unable-to-parse-uri-content-in-a-handler/16220/2 "2014-09-15T20:43:35Z")

</div>

Hi Anuj, have you read the documentation page on “failed\_when:”?

[http://docs.ansible.com/playbooks\_error\_handling.html#controlling-what-defines-failure](http://docs.ansible.com/playbooks_error_handling.html#controlling-what-defines-failure)

I believe you’d want to do something like this:

- name: reinit task\_handler  
uri: url=some\_url return\_content=yes  
register: webpage  
failed\_when: ‘“SOME ERROR STRING” in webpage.content’  
delegate\_to: localhost

---

<div class="post-metadata">

**Author:** ![Anuj\_Agrawal](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Anuj\_Agrawal](https://forum.ansible.com/u/Anuj_Agrawal)\
**Post date:** [September 16, 2014, 1:20pm UTC](https://forum.ansible.com/t/unable-to-parse-uri-content-in-a-handler/16220/3 "2014-09-16T13:20:56Z")

</div>

Hey James, thanks for your reply. Had found it. Forgot to update here.
