Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Commit

Permalink
Send class and arguments in context
Browse files Browse the repository at this point in the history
  • Loading branch information
jellybob committed Dec 13, 2013
1 parent 4570ea2 commit 05df39c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/resque/failure/sentry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def self.logger=(value)
def save
options = {}
options[:logger] = self.class.logger if self.class.logger
options[:extra] = {
"Object" => payload['class'],
"Arguments" => payload['args']
}
Raven.capture_exception(exception, options)
end

Expand Down
19 changes: 15 additions & 4 deletions spec/sentry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

describe Resque::Failure::Sentry do
it "sends errors to Sentry" do
sentry_options = {}
sentry_options = {
:extra => {
"Object" => Object,
"Arguments" => [ 1, "foo" ]
}
}
exception = StandardError.new("Test Error")
worker = Resque::Worker.new(:test)
queue = "test"
payload = {'class' => Object, 'args' => 1}
payload = {'class' => Object, 'args' => [ 1, "foo" ]}

event = mock
Raven.expects(:capture_exception).with(exception, sentry_options)
Expand All @@ -17,11 +22,17 @@

it "will use the configured Sentry logger" do
Resque::Failure::Sentry.logger = "resque"
sentry_options = { :logger => "resque" }
sentry_options = {
:logger => "resque",
:extra => {
"Object" => Object,
"Arguments" => [ 1, "foo" ]
}
}
exception = StandardError.new("Test Error")
worker = Resque::Worker.new(:test)
queue = "test"
payload = {'class' => Object, 'args' => 1}
payload = {'class' => Object, 'args' => [ 1, "foo" ]}

Raven.expects(:capture_exception).with(exception, sentry_options)
backend = Resque::Failure::Sentry.new(exception, worker, queue, payload)
Expand Down

0 comments on commit 05df39c

Please sign in to comment.