class VineApi::Response::RaiseError

Public Instance Methods

on_complete(env) click to toggle source
# File lib/vine_api/request.rb, line 63
def on_complete(env)
  case env[:status].to_i
  when 400...600
    raise VineApi::VineError.new(error_message(env))
  end
end

Private Instance Methods

error_body(body) click to toggle source
# File lib/vine_api/request.rb, line 81
def error_body(body)
  if body.nil?
    nil
  elsif body['error']
    body['error']
  end
end
error_message(env) click to toggle source
# File lib/vine_api/request.rb, line 72
def error_message(env)
  [
    env[:method].to_s.upcase,
    env[:url].to_s,
    env[:status],
    error_body(env[:body])
  ].join(': ')
end