Top "Rescue" questions

The Ruby keyword for catching exceptions.

work with rescue in Rails

I am working with the following piece; def index @user = User.find(params[:id]) rescue flash[:notice] = "ERROR" redirect_to(:…

ruby-on-rails ruby rescue
Passing multiple error classes to ruby's rescue clause in a DRY fashion

I have some code that needs to rescue multiple types of exceptions in ruby: begin a = rand if a > 0.5 …

ruby exception rescue
How to write down the rspec to test rescue block.?

I have method like this def className def method_name some code rescue some code and error message end end …

ruby-on-rails ruby rspec rescue
How can I password-protect my /sidekiq route (i.e. require authentication for the Sidekiq::Web tool)?

I am using sidekiq in my rails application. By Default, Sidekiq can be accessed by anybody by appending "/sidekiq" after …

ruby ruby-on-rails-3 redis rescue sidekiq
Ruby Timeout::timeout doesn't fire Exception and doesn't return what documented

I have this piece of code: begin complete_results = Timeout.timeout(4) do results = platform.search(artist, album_name) end rescue …

ruby-on-rails ruby timeout rescue
Begin Rescue not catching error

I'm using some ruby code wrapped in a begin - rescue block but somehow it manages to still crash. the …

ruby-on-rails ruby error-handling rescue
How to rescue an eval in Ruby?

I'm trying to figure out how to rescue syntax errors that come up when eval()ing code in Ruby 1.8.6. I …

ruby exception eval rescue
Ruby rescue and retry specific code block

I have the following code in my script... begin #Loop to create 1000 emails... #Loop to send 1000 emails... rescue Timeout::Error =&…

ruby loops rescue
Ruby Oneline Rescue

I recently learned that you can use rescue on a line of code in case something goes wrong on that …

ruby rescue
How to deal with not knowing what exceptions can be raised by a library method in Ruby?

This is somewhat of a broad question, but it is one that I continue to come across when programming in …

ruby exception exception-handling rescue