Get hoptoad notifications working from resque
This commit is contained in:
parent
09ac50aaac
commit
87ffce4f64
2 changed files with 13 additions and 3 deletions
|
|
@ -24,17 +24,18 @@ module ResqueJobLogging
|
|||
|
||||
Rails.logger.info(log_string)
|
||||
if error
|
||||
notify_hoptoad(error) 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
|
||||
Hoptoad.notify(
|
||||
HoptoadNotifier.notify(
|
||||
:error_class => error.class,
|
||||
:error_message => error.message,
|
||||
:parameters => {
|
||||
:job_class => self.name
|
||||
:job_class => self.name,
|
||||
:arguments => args}
|
||||
}
|
||||
)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -28,6 +28,15 @@ describe ResqueJobLogging do
|
|||
proc {
|
||||
ResqueJobLoggingDummy.around_perform_log_job("stuff"){raise "GRAAAAAAAAAGH"}
|
||||
}.should raise_error
|
||||
end
|
||||
|
||||
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"
|
||||
error = RuntimeError.new("GRAAAAAAAAAGH")
|
||||
ResqueJobLoggingDummy.should_receive(:notify_hoptoad).with(error)
|
||||
proc {
|
||||
ResqueJobLoggingDummy.around_perform_log_job("stuff"){raise error }
|
||||
}.should raise_error
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue