module Bugno::Middleware::ShowExceptions

Public Class Methods

included(base) click to toggle source
# File lib/bugno/middleware/rails/show_exceptions.rb, line 26
def self.included(base)
  base.send(:alias_method, :call_without_bugno, :call)
  base.send(:alias_method, :call, :call_with_bugno)

  base.send(:alias_method, :render_exception_without_bugno, :render_exception)
  base.send(:alias_method, :render_exception, :render_exception_with_bugno)
end

Public Instance Methods

call_with_bugno(env) click to toggle source
# File lib/bugno/middleware/rails/show_exceptions.rb, line 16
def call_with_bugno(env)
  call_without_bugno(env)
rescue ActionController::RoutingError => e
  raise e
end
extract_scope_from(env) click to toggle source
# File lib/bugno/middleware/rails/show_exceptions.rb, line 22
def extract_scope_from(env)
  env.env
end
render_exception_with_bugno(env, exception) click to toggle source
# File lib/bugno/middleware/rails/show_exceptions.rb, line 8
def render_exception_with_bugno(env, exception)
  if exception.is_a?(ActionController::RoutingError)
    Handler.call(exception: exception, env: extract_scope_from(env)) if Bugno.configured?
  end

  render_exception_without_bugno(env, exception)
end