Class: Rack::JiraExceptionCollector
- Inherits:
-
Object
- Object
- Rack::JiraExceptionCollector
- Defined in:
- lib/rack/jira_exception_collector.rb,
lib/rack/jira_exception_collector_version.rb
Defined Under Namespace
Classes: BacktraceLine, Error
Constant Summary collapse
- FILTER_REPLACEMENT =
"[FILTERED]"
- VERSION =
"0.8.3"
Instance Attribute Summary collapse
-
#collector_url ⇒ Object
Returns the value of attribute collector_url.
-
#environment_filters ⇒ Object
Returns the value of attribute environment_filters.
-
#error ⇒ Object
Returns the value of attribute error.
-
#failsafe ⇒ Object
Returns the value of attribute failsafe.
-
#rack_environment ⇒ Object
Returns the value of attribute rack_environment.
-
#report_under ⇒ Object
Returns the value of attribute report_under.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #environment_filter_keys ⇒ Object
- #environment_filter_regexps ⇒ Object
-
#initialize(app, collector_url = nil) {|_self| ... } ⇒ JiraExceptionCollector
constructor
A new instance of JiraExceptionCollector.
Constructor Details
#initialize(app, collector_url = nil) {|_self| ... } ⇒ JiraExceptionCollector
Returns a new instance of JiraExceptionCollector.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rack/jira_exception_collector.rb', line 18 def initialize(app, collector_url = nil) @app = app @collector_url = collector_url @report_under = %w(production staging) @rack_environment = "RACK_ENV" @environment_filters = %w(AWS_ACCESS_KEY AWS_SECRET_ACCESS_KEY AWS_ACCOUNT SSH_AUTH_SOCK) @failsafe = $stderr yield self if block_given? raise(Error, "You need to provide a collector URL") unless @collector_url end |
Instance Attribute Details
#collector_url ⇒ Object
Returns the value of attribute collector_url.
15 16 17 |
# File 'lib/rack/jira_exception_collector.rb', line 15 def collector_url @collector_url end |
#environment_filters ⇒ Object
Returns the value of attribute environment_filters.
15 16 17 |
# File 'lib/rack/jira_exception_collector.rb', line 15 def environment_filters @environment_filters end |
#error ⇒ Object
Returns the value of attribute error.
15 16 17 |
# File 'lib/rack/jira_exception_collector.rb', line 15 def error @error end |
#failsafe ⇒ Object
Returns the value of attribute failsafe.
15 16 17 |
# File 'lib/rack/jira_exception_collector.rb', line 15 def failsafe @failsafe end |
#rack_environment ⇒ Object
Returns the value of attribute rack_environment.
15 16 17 |
# File 'lib/rack/jira_exception_collector.rb', line 15 def rack_environment @rack_environment end |
#report_under ⇒ Object
Returns the value of attribute report_under.
15 16 17 |
# File 'lib/rack/jira_exception_collector.rb', line 15 def report_under @report_under end |
Instance Method Details
#call(env) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rack/jira_exception_collector.rb', line 29 def call(env) status, headers, body = begin @app.call(env) rescue StandardError, LoadError, SyntaxError => boom notified = send_exception boom, env raise end send_exception env['rack.exception'], env if env['rack.exception'] [status, headers, body] end |
#environment_filter_keys ⇒ Object
41 42 43 |
# File 'lib/rack/jira_exception_collector.rb', line 41 def environment_filter_keys @environment_filters.flatten end |
#environment_filter_regexps ⇒ Object
45 46 47 48 49 |
# File 'lib/rack/jira_exception_collector.rb', line 45 def environment_filter_regexps environment_filter_keys.map do |key| "^#{Regexp.escape(wrapped_key_for(key))}$" end end |