Exception: RubySMB::Error::UnexpectedStatusCode
- Inherits:
-
RubySMBError
- Object
- StandardError
- RubySMBError
- RubySMB::Error::UnexpectedStatusCode
- Defined in:
- lib/ruby_smb/error.rb
Overview
Raised when a response packet has a NTStatus code that was unexpected.
Instance Attribute Summary collapse
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(status_code) ⇒ UnexpectedStatusCode
constructor
A new instance of UnexpectedStatusCode.
- #to_s ⇒ Object
Constructor Details
#initialize(status_code) ⇒ UnexpectedStatusCode
Returns a new instance of UnexpectedStatusCode.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ruby_smb/error.rb', line 59 def initialize(status_code) case status_code when WindowsError::ErrorCode @status_code = status_code when Integer @status_code = WindowsError::NTStatus.find_by_retval(status_code).first if @status_code.nil? @status_code = WindowsError::ErrorCode.new("0x#{status_code.to_s(16)}", status_code, "Unknown 0x#{status_code.to_s(16)}") end else raise ArgumentError, "Status code must be a WindowsError::ErrorCode or an Integer, got #{status_code.class}" end super end |
Instance Attribute Details
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
57 58 59 |
# File 'lib/ruby_smb/error.rb', line 57 def status_code @status_code end |
Instance Method Details
#to_s ⇒ Object
74 75 76 |
# File 'lib/ruby_smb/error.rb', line 74 def to_s "The server responded with an unexpected status code: #{status_code.name}" end |