Skip to content

Commit

Permalink
raise error in generator if invalid expression is found
Browse files Browse the repository at this point in the history
easier to understand than method not found
  • Loading branch information
minad committed Mar 25, 2011
1 parent ec8e142 commit 3bbc515
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/temple/generators.rb
Expand Up @@ -79,7 +79,11 @@ def call(exp)

def compile(exp)
type, *args = exp
send("on_#{type}", *args)
if respond_to?("on_#{type}")
send("on_#{type}", *args)
else
raise "Generator supports only core expressions - found #{exp.inspect}"
end
end

def on_multi(*exp)
Expand Down

0 comments on commit 3bbc515

Please sign in to comment.