lib/nimbu-api/response/raise_error.rb in nimbu-api-0.0.1 vs lib/nimbu-api/response/raise_error.rb in nimbu-api-0.0.2

- old
+ new

@@ -5,14 +5,14 @@ module Nimbu class Response::RaiseError < Faraday::Response::Middleware def on_complete(env) - # status_code = env[:status].to_i - # service_error = Nimbu::Error::ServiceError - # error_class = service_error.errors[status_code] - # error_class = service_error if !error_class and (400...600).include? status_code - # raise error_class.new(env) if error_class + status_code = env[:status].to_i + service_error = Nimbu::Error::ServiceError + error_class = service_error.errors[status_code] + error_class = service_error if !error_class and (400...600).include? status_code + raise error_class.new(env) if error_class end end # Response::RaiseError end # Nimbu