Skip to content

Version 2.0 upgrade instructions

Sharagoz edited this page Jun 4, 2012 · 4 revisions

The big change in version 2 is that the users now have control over what information to store when an exception occurs.

To make version 2 backwards compatible with version 1 you need to add the following configuration to config/initializers/rails_exception_handler.rb:

config.store_request_info do |storage,request|
  storage[:target_url] =  request.url
  storage[:referer_url] = request.referer
  storage[:params] =      request.params.inspect
  storage[:user_agent] =  request.user_agent
end

config.store_exception_info do |storage,exception|
  storage[:class_name] =   exception.class.to_s
  storage[:message] =      exception.to_s
  storage[:trace] =        exception.backtrace.join("\n")
end

config.store_environment_info do |storage,env|
  # Not in use in version 1, can be removed
end

config.store_global_info do |storage|
  storage[:app_name] =     Rails.application.class.parent_name
  storage[:created_at] =   Time.now
end