Sha256: 05cc6edd48b9de12695358370fab28986cfeb19bf469f1bb7b799e4dd1486647

Contents?: true

Size: 1007 Bytes

Versions: 13

Compression:

Stored size: 1007 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 NotAuthorized < ClientError
    end

    class ConnectionError < ApiError
    end

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

    class Conflict < ServerError
      def message
        "Resource already exists"
      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

13 entries across 13 versions & 1 rubygems

Version Path
json_api_client-1.7.0 lib/json_api_client/errors.rb
json_api_client-1.6.4 lib/json_api_client/errors.rb
json_api_client-1.6.3 lib/json_api_client/errors.rb
json_api_client-1.6.2 lib/json_api_client/errors.rb
json_api_client-1.6.1 lib/json_api_client/errors.rb
json_api_client-1.6.0 lib/json_api_client/errors.rb
json_api_client-1.5.3 lib/json_api_client/errors.rb
json_api_client-1.5.2 lib/json_api_client/errors.rb
json_api_client-1.5.1 lib/json_api_client/errors.rb
json_api_client-1.5.0 lib/json_api_client/errors.rb
json_api_client-1.4.0 lib/json_api_client/errors.rb
json_api_client-1.3.0 lib/json_api_client/errors.rb
json_api_client-1.2.0 lib/json_api_client/errors.rb