Module: Hyperstack::Hotloader::AddErrorBoundry
- Defined in:
- lib/hyperstack/hotloader/add_error_boundry.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/hyperstack/hotloader/add_error_boundry.rb', line 4 def self.included(base) base.after_error do |*err| @err = err Hyperstack::Component.force_update! end base.define_method :render do @err ? parse_display_and_clear_error : top_level_render end end |
Instance Method Details
#display_error(e, component_stack) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/hyperstack/hotloader/add_error_boundry.rb', line 21 def display_error(e, component_stack) DIV do DIV { "Uncaught error: #{e}" } component_stack.each do |line| DIV { line } end end end |
#parse_display_and_clear_error ⇒ Object
14 15 16 17 18 19 |
# File 'lib/hyperstack/hotloader/add_error_boundry.rb', line 14 def parse_display_and_clear_error e = @err[0] component_stack = @err[1]['componentStack'].split("\n ") @err = nil display_error(e, component_stack) end |