Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Better error message for when badge is not specified in initializer.

  • Loading branch information...
commit 8c7253f96d0532e655655c31665110df5a896065 1 parent e8b1911
Tute Costa tute authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/merit/rule.rb
4 lib/merit/rule.rb
View
@@ -72,7 +72,9 @@ def badge
if @badge.nil?
badges = Badge.by_name(badge_name)
badges = badges.by_level(level) unless level.nil?
- @badge = badges.first
+ if !(@badge = badges.first)
+ raise "No badge '#{badge_name}'#{level.nil? ? '' : " with level #level"} found. Define it in 'config/initializers/merit.rb'."
+ end
end
@badge
end
Please sign in to comment.
Something went wrong with that request. Please try again.