Exception: Msf::Modules::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/msf/core/modules/error.rb

Overview

Base error class for all error under Msf::Modules

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Error

Returns a new instance of Error


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/msf/core/modules/error.rb', line 3

def initialize(attributes={})
  @module_path = attributes[:module_path]
  @module_reference_name = attributes[:module_reference_name]

  message_parts = []
  message_parts << "Failed to load module"

  if module_reference_name or module_path
    clause_parts = []

    if module_reference_name
      clause_parts << module_reference_name
    end

    if module_path
      clause_parts << "from #{module_path}"
    end

    clause = clause_parts.join(' ')
    message_parts << "(#{clause})"
  end

  causal_message = attributes[:causal_message]

  if causal_message
    message_parts << "due to #{causal_message}"
  end

  message = message_parts.join(' ')

  super(message)
end

Instance Attribute Details

#module_pathObject (readonly)

Returns the value of attribute module_path


37
38
39
# File 'lib/msf/core/modules/error.rb', line 37

def module_path
  @module_path
end

#module_reference_nameObject (readonly)

Returns the value of attribute module_reference_name


36
37
38
# File 'lib/msf/core/modules/error.rb', line 36

def module_reference_name
  @module_reference_name
end