Getting more descriptive ERB errors


I see that Rails provides very useful and descriptive ERB errors,
showing exactly which part of the template caused the error.

Is there anyway I can get this behavior for general (non
rails/ActionView) erb templates? I’m not opposed to requiring or
mixing in certain chunks of rails (or even copying and pasting code) -
just not sure how.

(Also, I know Rails has compilation and caching - anyway to do this?)