Sha256: 209f937f0e7d0a91aa86fab830fc768857ff62d98e66f8f47b7f63090e7e1cc4

Contents?: true

Size: 763 Bytes

Versions: 3

Compression:

Stored size: 763 Bytes

Contents

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

    class ClientError < 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

3 entries across 3 versions & 1 rubygems

Version Path
json_api_client-0.9.3 lib/json_api_client/errors.rb
json_api_client-0.9.2 lib/json_api_client/errors.rb
json_api_client-0.9.0 lib/json_api_client/errors.rb