# A beginner's question on exceptional handling,please help

**URL:** <https://www.ruby-forum.com/t/a-beginners-question-on-exceptional-handling-please-help/78746>\
**Category:** Ruby\
**Created:** [December 8, 2006, 8:34am UTC](https://www.ruby-forum.com/t/a-beginners-question-on-exceptional-handling-please-help/78746 "2006-12-08T08:34:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sampurna](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@sampurna](https://www.ruby-forum.com/u/sampurna)\
**Post date:** [December 8, 2006, 8:34am UTC](https://www.ruby-forum.com/t/a-beginners-question-on-exceptional-handling-please-help/78746/1 "2006-12-08T08:34:01Z")

</div>

Hi All,

In my code i am getting this exception.

(Watir::Exception::UnknownObjectException)

Can anybody help how to handle it

When this exception raises i want to do 1 operation

1. $IE0.image(:src, "  
[http://172.16.5.89/~tanu/nebo/src/www/images/wizards1.png](http://172.16.5.89/~tanu/nebo/src/www/images/wizards1.png)").click

when there is no exception i want to do 2 operation

1. $IE0.image(:src, "  
[http://172.16.5.89/~tanu/nebo/src/www/images/wizards.png](http://172.16.5.89/~tanu/nebo/src/www/images/wizards.png)").click

3.some operations i want to do always no matter exception is there or  
not.

Please help me soon,i need to fix it soon.

Thanks in Advance.

---

<div class="post-metadata">

**Author:** ![sampurna](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@sampurna](https://www.ruby-forum.com/u/sampurna)\
**Post date:** [December 8, 2006, 10:12am UTC](https://www.ruby-forum.com/t/a-beginners-question-on-exceptional-handling-please-help/78746/2 "2006-12-08T10:12:08Z")

</div>

begin

# … process

rescue

# … handle error

ensure

# … some code

end

See also: [http://www.rubycentral.com/book/tut\_exceptions.html](http://www.rubycentral.com/book/tut_exceptions.html)

cu  
pp
