Sha256: 1297ef3f1c00dbc32811c54872dd0a2f22d1ed8833aa62c3a146c96c45f6e6fa

Contents?: true

Size: 1.26 KB

Versions: 12

Compression:

Stored size: 1.26 KB

Contents

module Airbrake
  module Rails
    ##
    # Contains helper methods that can be used inside Rails controllers to send
    # notices to Airbrake. The main benefit of using them instead of the direct
    # API is that they automatically add information from the Rack environment
    # to notices.
    module ActionController
      private

      ##
      # A helper method for sending notices to Airbrake *asynchronously*.
      # Attaches information from the Rack env.
      # @see Airbrake#notify, #notify_airbrake_sync
      def notify_airbrake(exception, parameters = {}, notifier = :default)
        Airbrake.notify(build_notice(exception), parameters, notifier)
      end

      ##
      # A helper method for sending notices to Airbrake *synchronously*.
      # Attaches information from the Rack env.
      # @see Airbrake#notify_sync, #notify_airbrake
      def notify_airbrake_sync(exception, parameters = {}, notifier = :default)
        Airbrake.notify_sync(build_notice(exception), parameters, notifier)
      end

      ##
      # @param [Exception] exception
      # @return [Airbrake::Notice] the notice with information from the Rack env
      def build_notice(exception)
        Airbrake::Rack::NoticeBuilder.new(request.env).build_notice(exception)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
airbrake-5.2.3 lib/airbrake/rails/action_controller.rb
airbrake-5.2.2 lib/airbrake/rails/action_controller.rb
airbrake-5.2.1 lib/airbrake/rails/action_controller.rb
airbrake-5.2.0 lib/airbrake/rails/action_controller.rb
airbrake-5.1.0 lib/airbrake/rails/action_controller.rb
airbrake-5.0.5 lib/airbrake/rails/action_controller.rb
airbrake-5.0.4 lib/airbrake/rails/action_controller.rb
airbrake-5.0.3 lib/airbrake/rails/action_controller.rb
airbrake-5.0.2 lib/airbrake/rails/action_controller.rb
airbrake-5.0.1 lib/airbrake/rails/action_controller.rb
airbrake-5.0.0 lib/airbrake/rails/action_controller.rb
airbrake-5.0.0.rc.1 lib/airbrake/rails/action_controller.rb