Skip to content

Commit

Permalink
Sample of better error reporting for converters (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Oct 21, 2013
1 parent 6c1e8ac commit c6e37b2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/jrubyfx/utils/common_converters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ def converter_for(method_name, *converters, &default)
},
:color => lambda { |value|
new_value = NAME_TO_COLORS[value.to_s.gsub(/_/, "")]
if !new_value && value.kind_of?(Symbol)
raise ArgumentError.new("No such color: #{value.to_s}")
end
new_value ? new_value : value
},
:rectangle2d => lambda { |value|
Expand Down

0 comments on commit c6e37b2

Please sign in to comment.