monkeylearn / monkeylearn-ruby

Official Ruby client for the MonkeyLearn API. Build and consume machine learning models for language processing from your Ruby apps.
MIT License
80 stars 14 forks source link

Raise error when no API token set #6

Closed harlow closed 8 years ago

harlow commented 8 years ago

Previously if a token wasn't set you'd get a cryptic error:

TypeError: no implicit conversion of nil into String
    from /Users/harlow/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/monkeylearn-0.2/lib/monkeylearn/requests.rb:14:in `+'
    from /Users/harlow/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/monkeylearn-0.2/lib/monkeylearn/requests.rb:14:in `block in request'

This PR gives the users a little more context as to why things are failing.

gonz commented 8 years ago

Thanks @harlow