Skip to content

Commit

Permalink
Nicer error message when activating nonexistent rule (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
apjanke authored and jaymzh committed Oct 20, 2019
1 parent 30a6951 commit 672496b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/mdl/style.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ def all
end

def rule(id, params={})
if block_given?
raise "'rule' does not take a block. Should this definition go in a ruleset instead?"
end
id = @aliases[id] if @aliases[id]
unless @all_rules[id]
raise "No such rule: #{id}"
end
@rules << id
@all_rules[id].params(params)
end
Expand Down

0 comments on commit 672496b

Please sign in to comment.