Class: BugCourier::ExceptionHandler
- Inherits:
-
Object
- Object
- BugCourier::ExceptionHandler
- Defined in:
- lib/bug_courier/exception_handler.rb
Instance Method Summary collapse
- #handle(exception, env = {}) ⇒ Object
-
#initialize ⇒ ExceptionHandler
constructor
A new instance of ExceptionHandler.
Constructor Details
#initialize ⇒ ExceptionHandler
26 27 28 |
# File 'lib/bug_courier/exception_handler.rb', line 26 def initialize @rate_limiter = RateLimiter.new(max_per_hour: BugCourier.configuration.rate_limit) end |
Instance Method Details
#handle(exception, env = {}) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/bug_courier/exception_handler.rb', line 30 def handle(exception, env = {}) return unless BugCourier.configuration.enabled return unless BugCourier.configuration.valid? return if ignored?(exception) return unless @rate_limiter.allow? title = build_title(exception) body = build_body(exception, env) Thread.new do report(title, body) rescue StandardError => e BugCourier.logger&.error("[BugCourier] Async reporting failed: #{e.message}") end end |