Attach duration information to the exception object

This commit is contained in:
Felix Auringer
2021-06-28 12:03:20 +02:00
committed by Sebastian Serth
parent 36578a2817
commit 2dff81a510
9 changed files with 87 additions and 57 deletions

View File

@ -41,7 +41,14 @@ class Runner < ApplicationRecord
end
def attach_to_execution(command, &block)
@strategy.attach_to_execution(command, &block)
starting_time = Time.zone.now
begin
@strategy.attach_to_execution(command, &block)
rescue Runner::Error => e
e.execution_duration = Time.zone.now - starting_time
raise
end
Time.zone.now - starting_time # execution duration
end
def destroy_at_management