Sha256: 1d909ad8aa8caa9402ca4e855e69aa8aeb45e3a38f23c76e956788429fbe05f5

Contents?: true

Size: 855 Bytes

Versions: 9

Compression:

Stored size: 855 Bytes

Contents

module JsonApiClient
  module Errors
    class ApiError < StandardError
      attr_reader :env
      def initialize(env)
        @env = env
      end
    end

    class ClientError < ApiError
    end

    class AccessDenied < ClientError
    end

    class ConnectionError < ApiError
    end

    class ServerError < ApiError
      def message
        "Internal server error"
      end
    end

    class NotFound < ServerError
      attr_reader :uri
      def initialize(uri)
        @uri = uri
      end
      def message
        "Couldn't find resource at: #{uri.to_s}"
      end
    end

    class UnexpectedStatus < ServerError
      attr_reader :code, :uri
      def initialize(code, uri)
        @code = code
        @uri = uri
      end
      def message
        "Unexpected response status: #{code} from: #{uri.to_s}"
      end
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
json_api_client-1.0.1 lib/json_api_client/errors.rb
json_api_client-1.0.0 lib/json_api_client/errors.rb
json_api_client-1.0.0.beta7 lib/json_api_client/errors.rb
json_api_client-1.0.0.beta6 lib/json_api_client/errors.rb
json_api_client-1.0.0.beta5 lib/json_api_client/errors.rb
json_api_client-1.0.0.beta4 lib/json_api_client/errors.rb
json_api_client-1.0.0.beta3 lib/json_api_client/errors.rb
json_api_client-1.0.0.beta2 lib/json_api_client/errors.rb
json_api_client-1.0.0.beta lib/json_api_client/errors.rb