Exception: Takagi::Errors::ControllerNotFoundError
- Inherits:
-
TakagiError
- Object
- StandardError
- TakagiError
- Takagi::Errors::ControllerNotFoundError
- Defined in:
- lib/takagi/errors.rb
Overview
Raised when a reactor can’t find its expected controller
Instance Attribute Summary
Attributes inherited from TakagiError
Class Method Summary collapse
Methods inherited from TakagiError
Constructor Details
This class inherits a constructor from Takagi::Errors::TakagiError
Class Method Details
.missing_controller(reactor_class, controller_name, available_controllers) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/takagi/errors.rb', line 49 def self.missing_controller(reactor_class, controller_name, available_controllers) similar = RegistryError.find_similar( controller_name.to_s, available_controllers.map(&:to_s) ) suggestions = [] if similar.any? suggestions << "Did you mean #{similar.first}?" end suggestions.concat([ "Define #{controller_name} in your application", "Or use explicit config: configure { threads 4 }", "Or rename reactor to match an existing controller: #{available_controllers.first}" ]) new( "#{reactor_class} expected to find #{controller_name} but it doesn't exist", context: { reactor: reactor_class.name, expected_controller: controller_name, available_controllers: available_controllers.empty? ? "(none defined)" : available_controllers.inspect, pattern: "Reactors auto-inherit from matching controllers by naming convention" }, suggestions: suggestions ) end |