class Net::SFTP::StatusException

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

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) click to toggle source

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

# 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() click to toggle source

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

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