class SharkOnLambda::Middleware::Honeybadger
Attributes
Public Class Methods
new(app, tags: '')
click to toggle source
Calls superclass method
SharkOnLambda::Middleware::Base::new
# File lib/shark_on_lambda/middleware/honeybadger.rb, line 8 def initialize(app, tags: '') super(app) @tags = tags end
Public Instance Methods
call!(env)
click to toggle source
# File lib/shark_on_lambda/middleware/honeybadger.rb, line 14 def call!(env) app.call(env) rescue StandardError => e notify(e, env) unless shark_error?(e) && client_error?(e) raise e end
Private Instance Methods
client_error?(error)
click to toggle source
# File lib/shark_on_lambda/middleware/honeybadger.rb, line 24 def client_error?(error) error.respond_to?(:status) && error.status < 500 end
notify(error, env)
click to toggle source
# File lib/shark_on_lambda/middleware/honeybadger.rb, line 28 def notify(error, env) params = env.fetch('action_dispatch.request.parameters', {}) ::Honeybadger.notify( error, tags: tags, controller: params[:controller], action: params[:action], parameters: params ) end
shark_error?(error)
click to toggle source
# File lib/shark_on_lambda/middleware/honeybadger.rb, line 40 def shark_error?(error) error.is_a?(Errors::Base) end