lib/clickatell/response.rb in clickatell-0.1.0 vs lib/clickatell/response.rb in clickatell-0.2.0

- old
+ new

@@ -8,9 +8,12 @@ class << self PARSE_REGEX = /[A-Za-z0-9]+:.*?(?:(?=[A-Za-z0-9]+:)|$)/ # Returns the HTTP response body data as a hash. def parse(http_response) + if http_response.body.scan(/ERR/).any? + raise Clickatell::API::Error.parse(http_response.body) + end YAML.load(http_response.body.scan(PARSE_REGEX).join("\n")) end end \ No newline at end of file