Sha256: 44af5312972ad42c8b6083320a9d117aee17df1745034c0994e9fd0b1b369663

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module Mihari
  class Error < StandardError; end

  class ValueError < Error; end

  class RetryableError < Error; end

  class ConfigurationError < Error; end

  class IntegrityError < Error; end

  # errors for HTTP interactions
  class HTTPError < Error; end

  class NetworkError < HTTPError; end

  class TimeoutError < HTTPError; end

  #
  # HTTP status code error
  #
  class StatusCodeError < HTTPError
    # @return [Integer]
    attr_reader :status_code

    # @return [String, nil]
    attr_reader :body

    #
    # @param [String] msg
    # @param [Integer] status_code
    # @param [String, nil] body
    #
    def initialize(msg, status_code, body)
      super(msg)

      @status_code = status_code
      @body = body
    end
  end

  #
  # (dry-schema) Schema validation error
  #
  class ValidationError < Error
    attr_reader :errors

    #
    # @param [String] msg
    # @param [Dry::Schema::MessageSet] errors
    #
    def initialize(msg, errors)
      super(msg)

      @errors = errors
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mihari-7.0.4 lib/mihari/errors.rb
mihari-7.0.3 lib/mihari/errors.rb
mihari-7.0.2 lib/mihari/errors.rb
mihari-7.0.1 lib/mihari/errors.rb
mihari-7.0.0 lib/mihari/errors.rb