File: interceptor.rb

package info (click to toggle)
ruby-web-console 4.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 632 kB
  • sloc: ruby: 1,496; javascript: 497; sh: 19; makefile: 4
file content (17 lines) | stat: -rw-r--r-- 628 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module WebConsole
  module Interceptor
    def self.call(request, error)
      backtrace_cleaner = request.get_header("action_dispatch.backtrace_cleaner")

      # Get the original exception if ExceptionWrapper decides to follow it.
      Thread.current[:__web_console_exception] = error

      # ActionView::Template::Error bypass ExceptionWrapper original
      # exception following. The backtrace in the view is generated from
      # reaching out to original_exception in the view.
      if error.is_a?(ActionView::Template::Error)
        Thread.current[:__web_console_exception] = error.cause
      end
    end
  end
end