Exception: Msf::OptionValidateError
- Inherits:
-
ArgumentError
- Object
- ArgumentError
- Msf::OptionValidateError
- Includes:
- Exception
- Defined in:
- lib/msf/core/exception.rb
Overview
This exception is raised when one or more options failed to pass data store validation. The list of option names can be obtained through the options attribute.
A human readable error can be associated with each option, which can contain additional detail / context on why the option validation failed.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#reasons ⇒ Object
readonly
Returns the value of attribute reasons.
Instance Method Summary collapse
-
#initialize(options = [], reasons: {}, message: nil) ⇒ OptionValidateError
constructor
A new instance of OptionValidateError.
Constructor Details
#initialize(options = [], reasons: {}, message: nil) ⇒ OptionValidateError
Returns a new instance of OptionValidateError.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/msf/core/exception.rb', line 31 def initialize( = [], reasons: {}, message: nil) if .is_a?(Hash) @options = .keys @reasons = else @options = @reasons = reasons end @reasons = @reasons.transform_values { |value| Array(value) } super( || "The following options failed to validate: #{@options.join(', ')}.") end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
44 45 46 |
# File 'lib/msf/core/exception.rb', line 44 def @options end |
#reasons ⇒ Object (readonly)
Returns the value of attribute reasons.
44 45 46 |
# File 'lib/msf/core/exception.rb', line 44 def reasons @reasons end |