24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/logged_exception_rake.rb', line 24
def create_from_rake_exception(exception, rake_task, environment)
message = exception.message.inspect
max = environment.keys.max { |a,b| a.length <=> b.length }
env = environment.keys.sort.inject [] do |env, key|
env << '* ' + ("%-*s: %s" % [max.length, key, environment[key].to_s.strip])
end
e = create! :exception_class => exception.class.name,
:controller_name => 'RakeTask',
:action_name => rake_task.name,
:message => message,
:backtrace => exception.backtrace,
:environment => (env << "* Process: #{$$}") * "\n",
:request => ''
deliver_exception(e)
end
|