lib/webgen/contentprocessor/erubis.rb in webgen-0.5.8 vs lib/webgen/contentprocessor/erubis.rb in webgen-0.5.9
- old
+ new
@@ -27,14 +27,17 @@
erubis = if (!use_pi.nil? && use_pi) || (use_pi.nil? && context.website.config['contentprocessor.erubis.use_pi'])
::Erubis::PI::Eruby.new(context.content, options)
else
::Erubis::Eruby.new(context.content, options)
end
- erubis.filename = context.ref_node.absolute_lcn
+ erubis.filename = context.ref_node.alcn
context.content = erubis.result(binding)
context
+ rescue LoadError
+ raise Webgen::LoadError.new('erubis', self.class.name, context.dest_node.alcn, 'erubis')
rescue Exception => e
- raise RuntimeError, "Erubis processing failed in <#{context.ref_node.absolute_lcn}>: #{e.message}", e.backtrace
+ line = (e.is_a?(::SyntaxError) ? e.message : e.backtrace[0]).scan(/:(\d+)/).first.first.to_i rescue nil
+ raise Webgen::RenderError.new(e, self.class.name, context.dest_node.alcn, context.ref_node.alcn, line)
end
end
end