Error tracking
By default, RoRvsWild catches all exceptions raised by requests and jobs.
Configuration
Send errors manually
From a begin / rescue block:
begin
# Your code ...
rescue => exception
RorVsWild.record_error(exception)
end
Or:
RorVsWild.catch_error { 1 / 0 } # => #<ZeroDivisionError: divided by 0>
Add extra details
RorVsWild.record_error(exception, {something: "important"})
RorVsWild.catch_error(something: "important") { 1 / 0 }
Pre-fill context
It is also possible to pre-fill this context data at the begining of each request or job:
class ApplicationController < ActionController::Base
before_action :prefill_error_context
def prefill_error_context
RorVsWild.merge_error_context(something: "important")
end
end
Ignore specific exceptions
Use the ignored_exceptions parameter:
production:
api_key: "YOUR_API_KEY"
ignored_exceptions:
- ActionController::RoutingError
- ZeroDivisionError
Or with an initializer:
# config/initializers/rorvswild.rb
RorVsWild::Client.new(
api_key: "YOUR_API_KEY",
ignored_exceptions: [
"ActionController::RoutingError",
"ZeroDivisionError"
]
)
By default ActionController::RoutingError
is ignored in order to not be flooded with 404.