Sha256: 94c780945793d40b48eb6cff0ad8e1a3a0340106039c00217d2c07ad0b0ad2bd

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

module Ohnoes
  class FrontendExceptionsController < ActionController::Base
    skip_before_action :verify_authenticity_token

    def create
      notice = Hash.from_xml(CGI.unescape(request.body.read))

      error = notice["notice"]["error"]
      backtrace = error["backtrace"]["line"]

      frontend_exception = FrontendException.new(error["class"], error["message"], backtrace)

      # inlined somewhat from Appsignal::Rack::Listener
      key = SecureRandom.uuid

      transaction = Appsignal::Transaction.new(key, env)
      Appsignal.transactions[key] = transaction

      event = ActiveSupport::Notifications::Event.new('frontend_action', Time.now, Time.now, key, raw_payload(env))
      transaction.set_process_action_event(event)


      transaction.add_exception(frontend_exception)
      transaction.set_tags(frontend_exception: 'frontend_exception')

      def transaction.to_hash
        FrontendFormatter.new(self).to_hash
      end

      transaction.complete!

      render json: notice
    end

    def raw_payload(env)
      request = ::Rack::Request.new(env)
      {
          :controller => "foocontroller",
          :action => "baraction",
          :params => request.params,
          :method => request.request_method,
          :path   => request.path
      }
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ohnoes-0.0.1 app/controllers/ohnoes/frontend_exceptions_controller.rb