Exception: Net::SFTP::StatusException
- Defined in:
- lib/net/sftp/errors.rb
Overview
A exception class for reporting a non-success result of an operation.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
The error code (numeric).
-
#description ⇒ Object
readonly
The description of the error.
-
#response ⇒ Object
readonly
The response object that caused the exception.
-
#text ⇒ Object
readonly
Any incident-specific text given when the exception was raised.
Instance Method Summary collapse
-
#initialize(response, text = nil) ⇒ StatusException
constructor
Create a new status exception that reports the given code and description.
-
#message ⇒ Object
Override the default message format, to include the code and description.
Constructor Details
#initialize(response, text = nil) ⇒ StatusException
Create a new status exception that reports the given code and description.
23 24 25 26 27 28 |
# File 'lib/net/sftp/errors.rb', line 23 def initialize(response, text=nil) @response, @text = response, text @code = response.code @description = response. @description = Response::MAP[@code] if @description.nil? || @description.empty? end |
Instance Attribute Details
#code ⇒ Object (readonly)
The error code (numeric)
13 14 15 |
# File 'lib/net/sftp/errors.rb', line 13 def code @code end |
#description ⇒ Object (readonly)
The description of the error
16 17 18 |
# File 'lib/net/sftp/errors.rb', line 16 def description @description end |
#response ⇒ Object (readonly)
The response object that caused the exception.
10 11 12 |
# File 'lib/net/sftp/errors.rb', line 10 def response @response end |
#text ⇒ Object (readonly)
Any incident-specific text given when the exception was raised
19 20 21 |
# File 'lib/net/sftp/errors.rb', line 19 def text @text end |
Instance Method Details
#message ⇒ Object
Override the default message format, to include the code and description.
32 33 34 35 36 |
# File 'lib/net/sftp/errors.rb', line 32 def m = super.dup m << " #{text}" if text m << " (#{code}, #{description.inspect})" end |