-
-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support exception chaining #312
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,12 @@ module Raven | |
class ExceptionInterface < Interface | ||
|
||
name 'exception' | ||
attr_accessor :type | ||
attr_accessor :value | ||
attr_accessor :module | ||
attr_accessor :stacktrace | ||
attr_accessor :values | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now I can't find the old documentation for how Exception interfaces are supposed to work with Sentry. I thought that info was here: http://sentry.readthedocs.org/en/latest/developer/interfaces/ but it isn't anymore. @dcramer where'd that go? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docs should be fixed, but this looks correct to me (values is a list of exception instances) |
||
|
||
def to_hash(*args) | ||
data = super(*args) | ||
if data[:stacktrace] | ||
data[:stacktrace] = data[:stacktrace].to_hash | ||
if data[:values] | ||
data[:values] = data[:values].map(&:to_hash) | ||
end | ||
data | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'raven/interfaces' | ||
|
||
module Raven | ||
class SingleExceptionInterface < Interface | ||
|
||
attr_accessor :type | ||
attr_accessor :value | ||
attr_accessor :module | ||
attr_accessor :stacktrace | ||
|
||
def to_hash(*args) | ||
data = super(*args) | ||
if data[:stacktrace] | ||
data[:stacktrace] = data[:stacktrace].to_hash | ||
end | ||
data | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, I'm not really a fan of this name/a new class. Why can't you just use multiple instances of ExceptionInterface?