Sha256: 3eaec47cb341eb554fd34bec6b9b373a4a719bba8da4fa4a83499b21d632d19d

Contents?: true

Size: 609 Bytes

Versions: 5

Compression:

Stored size: 609 Bytes

Contents

# frozen_string_literal: true

module RakutenWebService
  class Error < StandardError
    def self.register(status_code, error)
      repository[status_code] = error
    end

    def self.repository
      @repository ||= {}
    end
  end

  class WrongParameter < Error; end
  Error.register(400, WrongParameter)

  class NotFound < Error; end
  Error.register(404, NotFound)

  class TooManyRequests < Error; end
  Error.register(429, TooManyRequests)

  class SystemError < Error; end
  Error.register(500, SystemError)

  class ServiceUnavailable < Error; end
  Error.register(503, ServiceUnavailable)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rakuten_web_service-1.12.0 lib/rakuten_web_service/error.rb
rakuten_web_service-1.11.0 lib/rakuten_web_service/error.rb
rakuten_web_service-1.10.0 lib/rakuten_web_service/error.rb
rakuten_web_service-1.9.2 lib/rakuten_web_service/error.rb
rakuten_web_service-1.9.1 lib/rakuten_web_service/error.rb