-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Track whether an error report was captured automatically (#369)
* Added support for handled-unhandled * Added severity-reasons to middleware * Moved ignored classes into middleware to set info
- Loading branch information
Showing
19 changed files
with
315 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
module Bugsnag::Middleware | ||
class ClassifyError | ||
INFO_CLASSES = [ | ||
"AbstractController::ActionNotFound", | ||
"ActionController::InvalidAuthenticityToken", | ||
"ActionController::ParameterMissing", | ||
"ActionController::UnknownAction", | ||
"ActionController::UnknownFormat", | ||
"ActionController::UnknownHttpMethod", | ||
"ActiveRecord::RecordNotFound", | ||
"CGI::Session::CookieStore::TamperedWithCookie", | ||
"Mongoid::Errors::DocumentNotFound", | ||
"SignalException", | ||
"SystemExit" | ||
] | ||
|
||
def initialize(bugsnag) | ||
@bugsnag = bugsnag | ||
end | ||
|
||
def call(notification) | ||
notification.exceptions.each do |ex| | ||
|
||
outer_break = false | ||
|
||
ancestor_chain = ex.class.ancestors.select { | ||
|ancestor| ancestor.is_a?(Class) | ||
}.map { | ||
|ancestor| ancestor.to_s | ||
} | ||
|
||
INFO_CLASSES.each do |info_class| | ||
if ancestor_chain.include?(info_class) | ||
notification.severity_reason = { | ||
:type => Bugsnag::Notification::ERROR_CLASS, | ||
:attributes => { | ||
:errorClass => info_class | ||
} | ||
} | ||
notification.severity = 'info' | ||
outer_break = true | ||
break | ||
end | ||
end | ||
|
||
break if outer_break | ||
end | ||
|
||
@bugsnag.call(notification) | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.