Catching exceptions in rake tasks executed from cron

Lukáš Konarovský's Avatar

Lukáš Konarovský

02 Dec, 2010 03:57 PM

Hi there, what is best way to catching exceptions in rake tasks executed from cron?

  1. 1 Posted by Ciaran Lee on 03 Dec, 2010 11:27 PM

    Ciaran Lee's Avatar

    Hi Lukas,
    Putting your code inside an Exceptional.rescue block should do the trick. Like so:

    Exceptional.rescue('Description of this task') do
      run_some_risky_code
    end
    

    I hope this helps you!
    Ciaran Lee

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac