Bugs: Browse | Submit New | Admin

[#20425] Provide a better error message if user creates the hand with an incorrect card string

Date:
2008-05-28 22:43
Priority:
2
Submitted By:
Robert Olson (aleran)
Assigned To:
Robert Olson (aleran)
Category:
None
State:
Open
Summary:
Provide a better error message if user creates the hand with an incorrect card string

Detailed description
A common mistake is for users to try and create a 10 card using '10' instead of 'T'. Add a nice error message if they
make this, or a similar, mistake.

athena ~ $ irb -r ruby-poker
>> PokerHand.new("10h")
NoMethodError: undefined method `-' for nil:NilClass
	from /Library/Ruby/Gems/1.8/gems/ruby-poker-0.3.0/lib/card.rb:33:in `face_value'
	from /Library/Ruby/Gems/1.8/gems/ruby-poker-0.3.0/lib/card.rb:52:in `build_from_face_suit'
	from /Library/Ruby/Gems/1.8/gems/ruby-poker-0.3.0/lib/card.rb:42:in `build_from_string'
	from /Library/Ruby/Gems/1.8/gems/ruby-poker-0.3.0/lib/card.rb:75:in `initialize'
	from /Library/Ruby/Gems/1.8/gems/ruby-poker-0.3.0/lib/ruby-poker.rb:26:in `new'
	from /Library/Ruby/Gems/1.8/gems/ruby-poker-0.3.0/lib/ruby-poker.rb:26:in `initialize'
	from /Library/Ruby/Gems/1.8/gems/ruby-poker-0.3.0/lib/ruby-poker.rb:26:in `map'
	from /Library/Ruby/Gems/1.8/gems/ruby-poker-0.3.0/lib/ruby-poker.rb:26:in `initialize'
	from (irb):1:in `new'
	from (irb):1

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item