lib/burghers/client.rb in burghers-0.0.3 vs lib/burghers/client.rb in burghers-0.0.4

- old
+ new

@@ -27,10 +27,12 @@ 'x-calais-licenseID' => @license, 'content-type' => content_type }.merge(headers || {}) response = HTTParty.post(URI, :body => content, :headers => headers) - if response.code != 200 + if response.code == 500 and response.to_s.include? "supported languages" + raise UnsupportedLanguageError, response.to_s + elsif response.code != 200 raise CalaisResponseError, "Got response code of #{response.code}: #{response}" end Response.new response.parsed_response end