Sha256: b0014dcf1f1de571013070795b59cce74aac2b7f2829f2a6a8cd355a0e4e38b7
Contents?: true
Size: 692 Bytes
Versions: 4
Compression:
Stored size: 692 Bytes
Contents
require 'faraday' module Faraday class Response::Errors < Response::Middleware begin def self.register_on_complete(env) env[:response].on_complete do |finished_env| case finished_env[:status] when 400 raise FiveMobilePush::GeneralError, finished_env[:body] when 401 raise FiveMobilePush::UnauthorizedError, finished_env[:body] when 500 raise FiveMobilePush::ServerError, 'push.fivemobile.com is currently down' end end end rescue LoadError, NameError => e self.load_error = e end def initialize(app) super @parser = nil end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
five_mobile_push-0.3.1 | lib/faraday/errors.rb |
five_mobile_push-0.3.0 | lib/faraday/errors.rb |
five_mobile_push-0.2.0 | lib/faraday/errors.rb |
five_mobile_push-0.1.0 | lib/faraday/errors.rb |