Sha256: becaaefd729eaad029267bc47bee2902cb3f8804d14d32ef81631447d24bee2d

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module Mihari
  class Error < StandardError; end

  class ValueError < Error; end

  class TypeError < Error; end

  class RetryableError < Error; end

  class FileNotFoundError < Error; end

  class ConfigurationError < Error; end

  # errors for HTTP interactions
  class HTTPError < Error; end

  class NetworkError < HTTPError; end

  class TimeoutError < HTTPError; end

  class SSLError < HTTPError; end

  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

  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

4 entries across 4 versions & 1 rubygems

Version Path
mihari-5.4.7 lib/mihari/errors.rb
mihari-5.4.6 lib/mihari/errors.rb
mihari-5.4.5 lib/mihari/errors.rb
mihari-5.4.4 lib/mihari/errors.rb