Sha256: cd0c269ee210eeb8e44b1c9e836466cbb8ecf6347be62a63b58ee8d487a98f67

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

module EBSCO

  module EDS
    class Error < StandardError
      attr_reader :fault
      def initialize(errors = nil)
        if errors
          @fault = errors
          super(errors[:error_body])
        end
      end
    end

    # raised with passing in invalid or unsupported parameter
    class InvalidParameter < StandardError; end

    # raised when attempting an action that is invalid/unsupported
    class ApiError < StandardError; end

    # Raised when trying an action that is not supported
    class NotImplemented < StandardError; end

    # HTTP related errors

    # raised when EDS returns the HTTP status code 400
    class BadRequest < Error; end

    # raised when EDS returns the HTTP status code 401
    class Unauthorized < Error; end

    # raised when EDS returns the HTTP status code 403
    class Forbidden < Error; end

    # raised when EDS returns the HTTP status code 404
    class NotFound < Error; end

    # Raised when EDS returns the HTTP status code 429
    class TooManyRequests < Error; end

    # Raised when EDS returns the HTTP status code 500
    class InternalServerError < Error; end

    # Raised when EDS returns the HTTP status code 503
    class ServiceUnavailable < Error; end

    # raised when connection fails
    class ConnectionFailed < Error; end

    # raised when missing a dependency
    class MissingDependency < Error; end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ebsco-eds-1.1.5 lib/ebsco/eds/error.rb
ebsco-eds-1.1.4 lib/ebsco/eds/error.rb
ebsco-eds-1.1.3 lib/ebsco/eds/error.rb