Module: RailsConsolePro::ErrorHandler

Extended by:
ErrorHandler
Includes:
ColorHelper
Included in:
ErrorHandler
Defined in:
lib/rails_console_pro/error_handler.rb

Overview

Unified error handler for consistent error handling across the gem

Instance Method Summary collapse

Methods included from ColorHelper

#bold_color, #color, #method_missing, #pastel, #respond_to_missing?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RailsConsolePro::ColorHelper

Instance Method Details

#handle(error, context: nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rails_console_pro/error_handler.rb', line 9

def handle(error, context: nil)
  case error
  when ActiveRecord::ConfigurationError
    handle_configuration_error(error, context)
  when ActiveRecord::StatementInvalid
    handle_sql_error(error, context)
  when ArgumentError
    handle_argument_error(error, context)
  when NameError
    handle_name_error(error, context)
  else
    handle_generic_error(error, context)
  end
end