module ExceptionNotification::RakeTaskExtensions
Public Instance Methods
Source
# File lib/exception_notification/rake.rb, line 11 def execute(args = nil) super rescue Exception => e # standard:disable Lint/RescueException ExceptionNotifier.notify_exception(e, data: data_for_exception_notifier(e)) unless e.is_a?(SystemExit) raise e end
A wrapper around the original execute
, that catches all errors and passes them on to ExceptionNotifier
.
Calls superclass method
Private Instance Methods
Source
# File lib/exception_notification/rake.rb, line 20 def data_for_exception_notifier(exception = nil) data = {} data[:error_class] = exception.class.name if exception data[:error_message] = exception.message if exception data[:rake] = {} data[:rake][:rake_command_line] = reconstruct_command_line data[:rake][:name] = name data[:rake][:timestamp] = timestamp.to_s # data[:investigation] = investigation data[:rake][:full_comment] = full_comment if full_comment data[:rake][:arg_names] = arg_names if arg_names.any? data[:rake][:arg_description] = arg_description if arg_description data[:rake][:locations] = locations if locations.any? data[:rake][:sources] = sources if sources.any? if prerequisite_tasks.any? data[:rake][:prerequisite_tasks] = prerequisite_tasks.map do |p| p.__send__(:data_for_exception_notifier)[:rake] end end data end
Source
# File lib/exception_notification/rake.rb, line 46 def reconstruct_command_line "rake #{ARGV.join(" ")}" end