Exception: ReactOnRails::SmartError
- Defined in:
- lib/react_on_rails/smart_error.rb
Overview
SmartError provides enhanced error messages with actionable suggestions rubocop:disable Metrics/ClassLength
Instance Attribute Summary collapse
-
#additional_context ⇒ Object
readonly
Returns the value of attribute additional_context.
-
#component_name ⇒ Object
readonly
Returns the value of attribute component_name.
-
#error_type ⇒ Object
readonly
Returns the value of attribute error_type.
-
#js_code ⇒ Object
readonly
Returns the value of attribute js_code.
-
#props ⇒ Object
readonly
Returns the value of attribute props.
Instance Method Summary collapse
-
#initialize(error_type:, component_name: nil, props: nil, js_code: nil, **additional_context) ⇒ SmartError
constructor
A new instance of SmartError.
- #solution ⇒ Object
Constructor Details
#initialize(error_type:, component_name: nil, props: nil, js_code: nil, **additional_context) ⇒ SmartError
Returns a new instance of SmartError.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/react_on_rails/smart_error.rb', line 11 def initialize(error_type:, component_name: nil, props: nil, js_code: nil, **additional_context) @error_type = error_type @component_name = component_name @props = props @js_code = js_code @additional_context = additional_context = super() end |
Instance Attribute Details
#additional_context ⇒ Object (readonly)
Returns the value of attribute additional_context.
9 10 11 |
# File 'lib/react_on_rails/smart_error.rb', line 9 def additional_context @additional_context end |
#component_name ⇒ Object (readonly)
Returns the value of attribute component_name.
9 10 11 |
# File 'lib/react_on_rails/smart_error.rb', line 9 def component_name @component_name end |
#error_type ⇒ Object (readonly)
Returns the value of attribute error_type.
9 10 11 |
# File 'lib/react_on_rails/smart_error.rb', line 9 def error_type @error_type end |
#js_code ⇒ Object (readonly)
Returns the value of attribute js_code.
9 10 11 |
# File 'lib/react_on_rails/smart_error.rb', line 9 def js_code @js_code end |
#props ⇒ Object (readonly)
Returns the value of attribute props.
9 10 11 |
# File 'lib/react_on_rails/smart_error.rb', line 9 def props @props end |
Instance Method Details
#solution ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/react_on_rails/smart_error.rb', line 22 def solution case error_type when :component_not_registered component_not_registered_solution when :missing_auto_loaded_bundle missing_auto_loaded_bundle_solution when :hydration_mismatch hydration_mismatch_solution when :server_rendering_error server_rendering_error_solution when :redux_store_not_found redux_store_not_found_solution when :configuration_error configuration_error_solution else default_solution end end |