diff --git a/lib/resque_job_logging.rb b/lib/resque_job_logging.rb index 8a2c9f521..899c1e25d 100644 --- a/lib/resque_job_logging.rb +++ b/lib/resque_job_logging.rb @@ -24,20 +24,21 @@ module ResqueJobLogging Rails.logger.info(log_string) if error - notify_hoptoad(error, args) if AppConfig[:hoptoad_api_key].present? && Rails.env.production? + notify_hoptoad(error, args) if AppConfig[:hoptoad_api_key].present? raise error end end - def notify_hoptoad error + def notify_hoptoad(error, job_arguments) + puts "Notifying hoptoad" HoptoadNotifier.notify( :error_class => error.class, :error_message => error.message, :parameters => { :job_class => self.name, - :arguments => args + :arguments => job_arguments } - ) + ) if Rails.env.production? end def application_trace(error) #copied from ActionDispatch::ShowExceptions diff --git a/spec/lib/resque_job_logging_spec.rb b/spec/lib/resque_job_logging_spec.rb index d4af125b4..cff02fb77 100644 --- a/spec/lib/resque_job_logging_spec.rb +++ b/spec/lib/resque_job_logging_spec.rb @@ -32,9 +32,9 @@ describe ResqueJobLogging do it 'notifies hoptoad if the hoptoad api key is set' do Rails.logger.should_receive(:info) - AppConfig.should_receive(:[]).with(:hoptoad_api_key).and_return "what" + AppConfig.should_receive(:[]).with(:hoptoad_api_key).and_return("what") error = RuntimeError.new("GRAAAAAAAAAGH") - ResqueJobLoggingDummy.should_receive(:notify_hoptoad).with(error) + ResqueJobLoggingDummy.should_receive(:notify_hoptoad).with(error, ["stuff"]) proc { ResqueJobLoggingDummy.around_perform_log_job("stuff"){raise error } }.should raise_error