Class: Glib::ErrorsController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Glib::ErrorsController
- Defined in:
- app/controllers/glib/errors_controller.rb
Overview
Receives browser-side JS error reports (see the npm package's
useGlibErrorReporter) and forwards them to the app's error tracker
server-side -- no client-side token or SDK needed. The client dedupes and
caps reports per page load, so this endpoint is not expected to see
sustained traffic.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/glib/errors_controller.rb', line 28 def create if defined?(Rollbar) # `GLib.log.warn` reports arrive with level=warning; everything else # (uncaught errors, `GLib.log.error`) is an error. Prefixed so # browser-side reports are distinguishable from server exceptions; # the details ride along as custom data for grouping. = params[:level] == 'warning' ? :warning : :error Rollbar.public_send( , "JS: #{params[:message]}", stack: params[:stack], url: params[:url], context: params[:context], user_agent: request.user_agent ) end head :no_content end |