Sha256: 6f7f23dd42c8393e1af1c1fcf515839ab1f1002e39b8a0ef93fe2e7f13ed97d6

Contents?: true

Size: 1.05 KB

Versions: 163

Compression:

Stored size: 1.05 KB

Contents

module Net; module SFTP

  # The base exception class for the SFTP system.
  class Exception < RuntimeError; end

  # A exception class for reporting a non-success result of an operation.
  class StatusException < Net::SFTP::Exception

    # The response object that caused the exception.
    attr_reader :response

    # The error code (numeric)
    attr_reader :code

    # The description of the error
    attr_reader :description

    # Any incident-specific text given when the exception was raised
    attr_reader :text

    # Create a new status exception that reports the given code and
    # description.
    def initialize(response, text=nil)
      @response, @text = response, text
      @code = response.code
      @description = response.message
      @description = Response::MAP[@code] if @description.nil? || @description.empty?
    end

    # Override the default message format, to include the code and
    # description.
    def message
      m = super.dup
      m << " #{text}" if text
      m << " (#{code}, #{description.inspect})"
    end

  end
end; end

Version data entries

163 entries across 125 versions & 10 rubygems

Version Path
net-sftp-backports-4.0.8.backports lib/net/sftp/errors.rb
net-sftp-backports-4.0.7.backports lib/net/sftp/errors.rb
net-sftp-backports-4.0.6.backports lib/net/sftp/errors.rb
net-sftp-backports-4.0.5.backports lib/net/sftp/errors.rb
net-sftp-backports-4.0.4.backports lib/net/sftp/errors.rb
net-sftp-backports-4.0.3.backports lib/net/sftp/errors.rb
net-sftp-backports-4.0.2.backports lib/net/sftp/errors.rb
net-sftp-backports-4.0.1.backports lib/net/sftp/errors.rb
net-sftp-backports-4.0.0.backports lib/net/sftp/errors.rb
net-sftp-4.0.0 lib/net/sftp/errors.rb
net-sftp-4.0.0.rc1 lib/net/sftp/errors.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/net-sftp-3.0.0/lib/net/sftp/errors.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/gems/net-sftp-3.0.0/lib/net/sftp/errors.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/net-sftp-3.0.0/lib/net/sftp/errors.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/gems/net-sftp-3.0.0/lib/net/sftp/errors.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/net-sftp-3.0.0/lib/net/sftp/errors.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/net-sftp-3.0.0/lib/net/sftp/errors.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/net-sftp-2.1.2/lib/net/sftp/errors.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/net-sftp-2.1.2/lib/net/sftp/errors.rb
net-sftp-3.0.0 lib/net/sftp/errors.rb