Sha256: f0ffa1a47963e0b8989ac607b5b65b4b9f1f4522c1a7bcb0b53ceec8124876c9

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

module Europeana
  module API
    module Errors
      ##
      # Raised if API requests are attempted without the API key having been set.
      class MissingAPIKeyError < StandardError
        def initialize(msg = nil)
          msg ||= <<-MSG
  Missing API key.

  The Europeana API key has not been set.

  Sign up for an API key at: http://labs.europeana.eu/api/registration/

  Set the key with:

    Europeana.api_key = "xyz"
          MSG
          super(msg)
        end
      end

      ##
      # Raised if the API response success flag is false, indicating a problem
      # with the request.
      class RequestError < StandardError
        def initialize(msg = nil)
          msg ||= <<-MSG
  Request error.

  There was a problem with your request to the Europeana API.
          MSG
          super(msg)
        end
      end

      ##
      # Raised if the API response is not valid JSON.
      class ResponseError < StandardError
        def initialize(msg = nil)
          msg ||= <<-MSG
  Response error.

  Unable to parse the response from the Europeana API.
          MSG
          super(msg)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
europeana-api-0.3.2 lib/europeana/api/errors.rb
europeana-api-0.3.1 lib/europeana/api/errors.rb
europeana-api-0.3.0 lib/europeana/api/errors.rb