lib/zan_tools/generatable.rb in zan_tools-0.1.1 vs lib/zan_tools/generatable.rb in zan_tools-0.1.2
- old
+ new
@@ -1,9 +1,11 @@
require 'erb'
require 'zan_tools/string'
module ZanTools
+ class TemplateError < StandardError; end
+
module Generatable
def self.included(host_class)
host_class.extend ClassMethods
end
@@ -30,9 +32,11 @@
end
def compile(tmpl)
template = ERB.new(tmpl, nil, '-')
template.result(binding)
+ rescue StandardError => e
+ raise TemplateError.new("#{e.class} - #{e.message}")
end
end
module ClassMethods
def config
\ No newline at end of file