Skip to content

Instantly share code, notes, and snippets.

@eric
Created April 27, 2012 21:56
Show Gist options
  • Save eric/2513708 to your computer and use it in GitHub Desktop.
Save eric/2513708 to your computer and use it in GitHub Desktop.
# Wrap tasks in exception notification
def task(*args, &block)
if block
wrapper = proc do |*a|
begin
block.call(*a)
rescue Interrupt, SignalException, SystemExit
raise
rescue Exception => e
Papertrail::ExceptionNotifier.notify(e) rescue nil
raise
end
end
Rake::Task.define_task(*args, &wrapper)
else
Rake::Task.define_task(*args, &block)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment