Right now, render_tag (in page_context.rb) rescues all exceptions and
turns them into HTML output. It’d be really nice to be able to use
exceptions within behaviors - especially within container tags.
F’rinstance, I’ve got a “style” tag that nests inside a “navigation”
container, and if that style tag is missing a required attribute, I’d
like to raise an exception to the navigation container so it doesn’t
continue trying to render. But the container calls tag.expand, which in
turn calls render_tag, which steals the exception from me.
I understand the intent, but I wonder if there’s a less intrusive way to
accomplish it, while still allowing outer tags to rescue their own
exceptions. What if that rescue were executed only on the outermost
tags? Would that break anything? It seems to me that this would still
prevent exceptions from crashing Rails, while allowing internal
OT but related: I tried reopening PageContext in my own plugin to make
this modification, but even a simple
results in the apparent loss of the class; behavior.rb then complains
that PageContext.new expects 0 arguments. Same if I do
class PageContext < Radiant::Context
I’m new to reopening classes; what am I doing wrong?