Sha256: 2be9c25aefcf5498ac32a537b9ef62255ee1946b1c88ad5ddacc1a9ae595b7f5
Contents?: true
Size: 450 Bytes
Versions: 4
Compression:
Stored size: 450 Bytes
Contents
# encoding: utf-8 module Outreach module Errors class Unauthorized < StandardError; end def check_for_error(status_code, response_body) # raise error if status code isn't 200 case status_code.to_i when 401 description = begin JSON.parse(response_body).fetch("error_description") rescue "Unauthorized" end raise Unauthorized.new(description) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
outreach-0.1.2 | lib/outreach/errors.rb |
outreach-0.1.1 | lib/outreach/errors.rb |
outreach-0.1.0 | lib/outreach/errors.rb |
outreach-0.0.2 | lib/outreach/errors.rb |