Sha256: 926388e17e0df453edc6406d9aaeca7f7da98cf458684838a2dffbdee03f5794

Contents?: true

Size: 1.07 KB

Versions: 7

Compression:

Stored size: 1.07 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

  #
  # 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

7 entries across 7 versions & 1 rubygems

Version Path
mihari-6.3.0 lib/mihari/errors.rb
mihari-6.2.0 lib/mihari/errors.rb
mihari-6.1.0 lib/mihari/errors.rb
mihari-6.0.0 lib/mihari/errors.rb
mihari-5.7.2 lib/mihari/errors.rb
mihari-5.7.1 lib/mihari/errors.rb
mihari-5.7.0 lib/mihari/errors.rb