lib/arbre/patches.rb in express_templates-0.11.3 vs lib/arbre/patches.rb in express_templates-0.11.4

- old
+ new

@@ -16,15 +16,24 @@ def build_tag(klass, *args, &block) tag = klass.new(arbre_context) tag.parent = current_arbre_element with_current_arbre_element tag do - tag.build(*args, &block) + begin + tag.build(*args, &block) + rescue Exception => e + on_component_error(tag, e) + end end tag end + + def on_component_error(tag, exception) + tag.content = "Error rendering #{tag.class} component: #{exception.message}" + ::Rails.logger.error exception + end end def possible_route_proxy(name) if helpers.controller.class.parent && helpers.respond_to?(namespace = helpers.controller.class.parent.to_s.underscore) @@ -71,6 +80,6 @@ end end end -end \ No newline at end of file +end