Skip to content

Commit

Permalink
improved error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dreinavarro committed Apr 15, 2015
1 parent 40e57a1 commit 7f04281
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chikka.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'chikka'
s.version = '0.1.9'
s.version = '0.2.0'
s.date = '2015-04-15'
s.summary = 'A ruby interface to the Chikka SMS API'
s.authors = ["Andrei Navarro"]
Expand Down
8 changes: 5 additions & 3 deletions lib/chikka.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Chikka

class Error < StandardError; end

class IncompleteParametersError < Error; end
class BadRequestError < Error; end

class AuthenticationError < Error; end

Expand Down Expand Up @@ -72,9 +72,11 @@ def parse(http_response, message_id)
when 200
response_obj
when 401
raise AuthenticationError.new(message="#{response_obj.message} HTTP_RESP: #{response_obj.description}")
raise AuthenticationError.new(message=response_obj.description)
when 400
raise BadRequestError.new(message = response_obj.description)
else
raise Error.new(message="#{response_obj.message} HTTP_RESP: #{response_obj.description}")
raise Error.new(message=response_obj.description)
end
end
end
Expand Down

0 comments on commit 7f04281

Please sign in to comment.