Class: RailsLens::ErrorReporter
- Inherits:
-
Object
- Object
- RailsLens::ErrorReporter
- Defined in:
- lib/rails_lens/errors.rb
Overview
Error reporter for centralized error handling
Class Method Summary collapse
Class Method Details
.handle(context = {}) ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/rails_lens/errors.rb', line 58 def handle(context = {}) yield rescue StandardError => e report(e, context) raise if RailsLens.raise_on_error nil end |
.report(error, context = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rails_lens/errors.rb', line 44 def report(error, context = {}) return unless RailsLens.verbose || RailsLens.debug = (error, context) # Use Rails logger for verbose mode RailsLens.logger.error # Use kernel output for debug mode to ensure visibility return unless RailsLens.debug RailsLens.logger.debug end |