Sha256: dad3fd67107133793c93ec6bae5841bffe51912e5c25e4b1b4a55ae451f88d0b

Contents?: true

Size: 393 Bytes

Versions: 13

Compression:

Stored size: 393 Bytes

Contents

module IEX
  module Errors
    class ClientError < StandardError
      attr_reader :response

      def initialize(response)
        @response = response
        super error
      end

      def error
        if body.is_a?(Hash) && body.key?('error')
          body['error']
        else
          body
        end
      end

      def body
        response[:body]
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
iex-ruby-client-2.1.0 lib/iex/errors/client_error.rb
iex-ruby-client-2.0.0 lib/iex/errors/client_error.rb
iex-ruby-client-1.6.0 lib/iex/errors/client_error.rb
iex-ruby-client-1.5.0 lib/iex/errors/client_error.rb
iex-ruby-client-1.4.1 lib/iex/errors/client_error.rb
iex-ruby-client-1.4.0 lib/iex/errors/client_error.rb
iex-ruby-client-1.3.0 lib/iex/errors/client_error.rb
iex-ruby-client-1.2.0 lib/iex/errors/client_error.rb
iex-ruby-client-1.1.2 lib/iex/errors/client_error.rb
iex-ruby-client-1.1.1 lib/iex/errors/client_error.rb
iex-ruby-client-1.1.0 lib/iex/errors/client_error.rb
iex-ruby-client-1.0.1 lib/iex/errors/client_error.rb
iex-ruby-client-1.0.0 lib/iex/errors/client_error.rb