Class: WatCatcher::BugsnagController

Inherits:
ActionController::Base
  • Object
show all
Includes:
CatcherOfWats
Defined in:
app/controllers/wat_catcher/bugsnag_controller.rb

Instance Method Summary collapse

Methods included from CatcherOfWats

#catch_wats, #disable_wat_report, #report_wat?, #wat_user

Instance Method Details

#showObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/wat_catcher/bugsnag_controller.rb', line 6

def show
  request.params[:wat] = HashWithIndifferentAccess.new
  request.params[:wat][:backtrace] = stacktrace
  request.params[:wat][:message] = params[:message]
  request.params[:wat][:page_url] = params[:url]
  request.params[:wat][:language] = 'javascript'

  begin
    user = JSON.parse(params[:user])
  rescue JSON::ParserError;end
ensure
  @report = Report.new(nil, user: user, request: request)
  response.headers['Content-Type'] = "image/png; charset=utf-8"
  head :ok
end

#stacktraceObject



22
23
24
# File 'app/controllers/wat_catcher/bugsnag_controller.rb', line 22

def stacktrace
  params[:stacktrace].split("\n")[1..-1]
end