Skip to content

Commit

Permalink
Nicer error message when activating nonexistent rule
Browse files Browse the repository at this point in the history
  • Loading branch information
apjanke committed Dec 20, 2018
1 parent a9e80fc commit 504a3cb
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]
if @all_rules[id].nil?
raise "No such rule: #{id}"
end
@rules << id
@all_rules[id].params(params)
end
Expand Down

0 comments on commit 504a3cb

Please sign in to comment.