def notify(exception, packet = nil, agent = nil, component = nil)
      if @notify_enabled
        if packet && packet.is_a?(Packet)
          action = packet.type.split("/").last if packet.respond_to?(:type)
          params = packet.respond_to?(:payload) && packet.payload
          uuid = packet.respond_to?(:token) && packet.token
        elsif packet.is_a?(Hash)
          action_path = packet[:path] || packet["path"]
          action = action_path.split("/").last if action_path
          params = packet[:data] || packet["data"]
          uuid = packet[:uuid] || packet["uuid"]
        else
          params = uuid = nil
        end

        component = component.class.name unless component.is_a?(String)

        n = Airbrake.build_notice(
          exception,
          { component: component, action: action },
          :right_agent )

        n[:params] = params.is_a?(Hash) ? filter(params) : {:param => params} if params
        n[:session] = { :uuid => uuid } if uuid

        if agent
          n[:environment] = (@cgi_data || {}).merge(:agent_class => agent.class.name)
        elsif @cgi_data
          n[:environment] = @cgi_data || {}
        end

        Airbrake.notify(n, {}, :right_agent)
      end
      true
    rescue Exception => e
      raise if e.class.name =~ /^RSpec/ # keep us from going insane while running tests
      Log.error("Failed to notify Errbit", e, :trace)
    end
def notify(exception, packet = nil, agent = nil, component = nil)
      if @notify_enabled
        if packet && packet.is_a?(Packet)
          action = packet.type.split("/").last if packet.respond_to?(:type)
          params = packet.respond_to?(:payload) && packet.payload
          uuid = packet.respond_to?(:token) && packet.token
        elsif packet.is_a?(Hash)
          action_path = packet[:path] || packet["path"]
          action = action_path.split("/").last if action_path
          params = packet[:data] || packet["data"]
          uuid = packet[:uuid] || packet["uuid"]
        else
          params = uuid = nil
        end

        component = component.class.name unless component.is_a?(String)

        n = Airbrake.build_notice(
          exception,
          { component: component, action: action },
          :right_agent )

        n[:params] = params.is_a?(Hash) ? filter(params) : {:param => params} if params
        n[:session] = { :uuid => uuid } if uuid

        if agent
          n[:environment] = (@cgi_data || {}).merge(:agent_class => agent.class.name)
        elsif @cgi_data
          n[:environment] = @cgi_data || {}
        end

        Airbrake.notify(n, {}, :right_agent)
      end
      true
    rescue Exception => e
      raise if e.class.name =~ /^RSpec/ # keep us from going insane while running tests
      Log.error("Failed to notify Errbit", e, :trace)
    end
Notify Errbit of error if notification enabled

 @param [Exception, String] exception raised
 @param [Packet, Hash] packet associated with exception
 @param [Object] agent object reporting error
 @param [String,Object] component or service area where error occurred

 @return [TrueClass] always true