Sha256: 97dfc4154042a7ca98419bd3d68851a913373def7b4f332d90c53a661eff809b
Contents?: true
Size: 658 Bytes
Versions: 12
Compression:
Stored size: 658 Bytes
Contents
require 'faraday' module Ably module Rest module Middleware # HTTP exceptions raised due to a status code error on a 3rd party site # Used by auth calls class ExternalExceptions < Faraday::Middleware def on_complete(env) if env.status >= 400 error_status_code = env.status message = "Error #{error_status_code}: #{(env.body || '')[0...200]}" if error_status_code >= 500 raise Ably::Exceptions::ServerError, message else raise Ably::Exceptions::InvalidRequest, message end end end end end end end
Version data entries
12 entries across 12 versions & 2 rubygems