forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.rb
More file actions
27 lines (26 loc) · 1.12 KB
/
Copy patherrors.rb
File metadata and controls
27 lines (26 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# This initializer registers the two interal tools canvas uses
# for tracking errors. One (:error_report) creates a record in the
# error_reports database table for each exception that occurs. The
# other (:error_stats) will send two counter increments to statsd,
# one for "all" which tabulates every error that occurs, and one
# that includes the class of the exception in the key so you
# can see big spikes in a certain kind of error. Either can be
# disabled individually with a setting.
#
Rails.configuration.to_prepare do
ErrorReport.configure_to_ignore(%w{
AuthenticationMethods::AccessTokenError
ActionController::InvalidAuthenticityToken
})
Canvas::Errors.register!(:error_report) do |exception, data|
setting = Setting.get("error_report_exception_handling", 'true')
if setting == 'true'
report = ErrorReport.log_exception_from_canvas_errors(exception, data)
report.try(:global_id)
end
end
Canvas::Errors.register!(:error_stats) do |exception, data|
setting = Setting.get("collect_error_statistics", 'true')
Canvas::ErrorStats.capture(exception, data) if setting == 'true'
end
end