# Error Handeling

**URL:** <https://www.ruby-forum.com/t/error-handeling/149259>\
**Category:** Rails\
**Created:** [September 23, 2008, 12:49am UTC](https://www.ruby-forum.com/t/error-handeling/149259 "2008-09-23T00:49:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [September 23, 2008, 12:49am UTC](https://www.ruby-forum.com/t/error-handeling/149259/1 "2008-09-23T00:49:10Z")

</div>

Is it possible to have error handling or error tolerances inside of a  
ruby controller?

So when my lucene java server has a hiccup and causes my Acts\_As\_solr  
search to quit working, i can use good old fashioned .find. For example:

@phrase = Phrase.find\_by\_solr(“search\_term”)

if error  
@phrase = Phrase.find(:first, :conditions =\> {“search\_term”})  
end

Ruby 1.8.6, Rails 2.1.0, OSX

---

<div class="post-metadata">

**Author:** ![indigoi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@indigoi](https://www.ruby-forum.com/u/indigoi)\
**Post date:** [September 23, 2008, 5:01am UTC](https://www.ruby-forum.com/t/error-handeling/149259/2 "2008-09-23T05:01:21Z")

</div>

On Mon, Sep 22, 2008 at 3:49 PM, Richard S.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> if error  
> @phrase = Phrase.find(:first, :conditions =\> {“search\_term”})  
> end

Yes, you can use rescue[1] to do this. You’ll need to track down the  
exception that is being thrown and rescue the application.

[1] [Exceptions, Catch, and Throw](http://phrogz.net/ProgrammingRuby/tut_exceptions.html)

Good luck!

## Cheers, Robby

Robby R.  
Chief Evangelist, Partner

PLANET ARGON, LLC  
design // development // hosting

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[http://www.robbyonrails.com/](http://www.robbyonrails.com/)  
aim: planetargon

+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4068 [fax]
