Sha256: fb3d2d4c1d044f2d793e17bad23207e96fe6a262debc13a0f60ca723ea8cf2cd

Contents?: true

Size: 333 Bytes

Versions: 5

Compression:

Stored size: 333 Bytes

Contents

module Pwinty
	class HttpErrors < Faraday::Response::Middleware
		def on_complete(env)
			msg = env[:body]
			case env[:status]
			when 401; raise Pwinty::AuthenticationError, msg
			when 403; raise Pwinty::StateIsInvalid, msg
			when 404; raise Pwinty::OrderNotFound, msg
			when 500; raise Pwinty::Error, msg
			end
		end
	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pwinty-3.0.4 lib/pwinty/http_errors.rb
pwinty-3.0.3 lib/pwinty/http_errors.rb
pwinty-3.0.2 lib/pwinty/http_errors.rb
pwinty-3.0.1 lib/pwinty/http_errors.rb
pwinty-3.0.0 lib/pwinty/http_errors.rb