Sha256: 0fdf9bea7022abf9a57674282cde811ced4281b83bc8189e604f166653be4a10

Contents?: true

Size: 338 Bytes

Versions: 3

Compression:

Stored size: 338 Bytes

Contents

require 'plaza/models/error'

module Plaza::Middleware
  class Exceptions < Faraday::Middleware
    def call(env)
      begin
        @app.call(env)
      rescue Faraday::Error::ConnectionFailed => e
        error = Plaza::ConnectionError.new(nil, 'Service is not available.')
        raise(error, error.to_s)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
plaza-0.1.1 lib/plaza/middleware/exceptions.rb
plaza-0.1.0 lib/plaza/middleware/exceptions.rb
plaza-0.0.4 lib/plaza/middleware/exceptions.rb