class Net::SFTP::StatusException

  1. lib/net/sftp/errors.rb
Parent: SFTP

A exception class for reporting a non-success result of an operation.

Methods

Public Class

  1. new

Public Instance

  1. code
  2. description
  3. message
  4. response
  5. text

Attributes

code [R]

The error code (numeric)

description [R]

The description of the error

response [R]

The response object that caused the exception.

text [R]

Any incident-specific text given when the exception was raised

Public Class methods

new (response, text=nil)

Create a new status exception that reports the given code and description.

[show source]
# File lib/net/sftp/errors.rb, line 23
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

Public Instance methods

message ()

Override the default message format, to include the code and description.

[show source]
# File lib/net/sftp/errors.rb, line 32
def message
  m = super.dup
  m << " #{text}" if text
  m << " (#{code}, #{description.inspect})"
end