# frozen_string_literal: true

module Socketry
  # Generic catch all for all Socketry errors
  Error = Class.new(::IOError)

  # Invalid address
  AddressError = Class.new(Socketry::Error)

  # Timeouts performing an I/O operation
  TimeoutError = Class.new(Socketry::Error)

  # Cannot perform operation in current state
  StateError = Class.new(Socketry::Error)

  # Internal consistency error within the library
  InternalError = Class.new(Socketry::Error)

  module Resolver
    # DNS resolution errors
    Error = Class.new(Socketry::AddressError)
  end

  module SSL
    # Errors related to SSL
    Error = Class.new(Socketry::Error)

    # Hostname verification error
    HostnameError = Class.new(Socketry::SSL::Error)
  end
end

# frozen_string_literal: true

module Socketry
  # Generic catch all for all Socketry errors
  Error = Class.new(StandardError)

  # Invalid address
  AddressError = Class.new(Socketry::Error)

  # Timeouts performing an I/O operation
  TimeoutError = Class.new(Socketry::Error)

  # Cannot perform operation in current state
  StateError = Class.new(Socketry::Error)

  # Internal consistency error within the library
  InternalError = Class.new(Socketry::Error)

  module Resolver
    # DNS resolution errors
    Error = Class.new(Socketry::AddressError)
  end

  module SSL
    # Errors related to SSL
    Error = Class.new(Socketry::Error)

    # Hostname verification error
    HostnameError = Class.new(Socketry::SSL::Error)
  end
end

Use StandardError as the base class for Socketry::Error
Use StandardError as the base class for Socketry::Error

Previously it was using IOError, which makes it more difficult to differentiate
exceptions raised by Socketry from ones raised from MRI's I/O.
