rubygems/rubygems — pull request #215 by arsduo (2011-11-18 11:27:39+00:00)
Title: Raise a more specific error for illformed requirements

I recently ran into the following error after making a typo in my Gemfile:

```
Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!
/Users/ahkoppel2/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/requirement.rb:98:in `parse': Illformed requirement [">~ 3.0"] (ArgumentError)
```

Bundler ought to be giving a clearer message here -- Rubygems has identified the problem, and no amount of Github issues will fix it. Unfortunately, there's currently no way for Bundler to distinguish illformed requirements from any other ArgumentError without parsing the text of the error message, which isn't an ideal approach.

This is a pretty small commit (with tests) that creates a IllformedRequirementError < ArgumentError class, and raises that as appropriate. I'll submit a pull request to Bundler either way (using the error message initially) and if this gets accepted, I'll update that to use the new error class.

Thanks for the great work!

Best,

Alex