Class: Whoopsie::ErrorsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Whoopsie::ErrorsController
- Defined in:
- app/controllers/whoopsie/errors_controller.rb
Defined Under Namespace
Classes: JavaScriptError
Instance Method Summary collapse
-
#bang ⇒ Object
Call this method to test Whoopsie in your live production app.
-
#create ⇒ Object
Create a JavaScript exception and notify as configured Params: error_report: A hash containing :message as a string extra: Contextual data.
-
#ping ⇒ Object
Make sure Whoopsie is available.
Instance Method Details
#bang ⇒ Object
Call this method to test Whoopsie in your live production app.
32 33 34 |
# File 'app/controllers/whoopsie/errors_controller.rb', line 32 def bang fail('boom!') end |
#create ⇒ Object
Create a JavaScript exception and notify as configured Params:
error_report: A hash containing :message as a string
extra: Contextual data
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/whoopsie/errors_controller.rb', line 16 def create if Rails.application.config.whoopsie.enable exception = JavaScriptError.new(report_params[:message]) report_params.merge!(extra: params[:extra]) if params[:extra] ExceptionNotifier.notify_exception( exception, env: request.env, data: report_params ) render plain: 'error acknowledged', status: :ok else render plain: 'error ignored', status: :accepted end end |
#ping ⇒ Object
Make sure Whoopsie is available
37 38 39 40 41 |
# File 'app/controllers/whoopsie/errors_controller.rb', line 37 def ping app_name = Rails.application.engine_name db_status = !ActiveRecord::Base.connection.tables.empty? ? :ok : :empty render plain: "#{app_name} #{db_status}" end |