Sha256: 0bf5b85792f7485c04401f57e5ba6f379c496aae5f6d86b384ca6132a459e9cc

Contents?: true

Size: 759 Bytes

Versions: 19

Compression:

Stored size: 759 Bytes

Contents

module JsonApiClient
  module Errors
    class ApiError < Exception
      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

19 entries across 19 versions & 1 rubygems

Version Path
json_api_client-0.8.1 lib/json_api_client/errors.rb
json_api_client-0.8.0 lib/json_api_client/errors.rb
json_api_client-0.7.1 lib/json_api_client/errors.rb
json_api_client-0.7.0 lib/json_api_client/errors.rb
json_api_client-0.6.0 lib/json_api_client/errors.rb
json_api_client-0.5.1 lib/json_api_client/errors.rb
json_api_client-0.5.0 lib/json_api_client/errors.rb
json_api_client-0.4.0 lib/json_api_client/errors.rb
json_api_client-0.3.1 lib/json_api_client/errors.rb
json_api_client-0.3.0 lib/json_api_client/errors.rb
json_api_client-0.2.4 lib/json_api_client/errors.rb
json_api_client-0.2.3 lib/json_api_client/errors.rb
json_api_client-0.2.2 lib/json_api_client/errors.rb
json_api_client-0.2.1 lib/json_api_client/errors.rb
json_api_client-0.2.0 lib/json_api_client/errors.rb
json_api_client-0.1.3 lib/json_api_client/errors.rb
json_api_client-0.1.2 lib/json_api_client/errors.rb
json_api_client-0.1.1 lib/json_api_client/errors.rb
json_api_client-0.0.3 lib/json_api_client/errors.rb