I have this in a delayed job.
def perform begin validation_warnings = Account.global_import_legacy_accounts(billing_run.legacy_master_iif_csv.path) rescue Exception => e BackgroundProcessStatus.update(:status => “Process failed. Error: #{e}.”) end end
I am finding that if an exception ocurrs somewhere in the code which is being called (i.e. somewhere in Account#global_import_legacy_accounts), the job just quits and does not go into my rescue clause. Am I confused that if I have something wrapped in an begin…rescue that any exception below it should raise up to this clause, or am I just having flashbacks of how C# handles it? Anyway, what I need is a strategy to send a message and do something if anything goes wrong in my delayed_job.