module Veeqo::HttpErrors
Constants
- ERRORS
Public Instance Methods
throw_http_exception!(code, env)
click to toggle source
# File lib/veeqo/exception.rb, line 42 def throw_http_exception!(code, env) return unless ERRORS.keys.include? code response_headers = {} unless env.body.empty? response_headers = begin Oj.load(env.body, symbol_keys: true) rescue {} end end unless env[:response_headers] && env[:response_headers]['X-Retry-After'].nil? response_headers[:retry_after] = env[:response_headers]['X-Retry-After'].to_i end raise ERRORS[code].new(response_headers), env.body end