5e123e024d
This fixes a huge number of hard-to-detect runtime bugs that occur when a default utf-8 string from one of these libraries is passed into a method expecting ascii-8bit
39 lines
913 B
Ruby
39 lines
913 B
Ruby
# -*- coding: binary -*-
|
|
# Base error class for all error under {Msf::Modules}
|
|
class Msf::Modules::Error < StandardError
|
|
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
|
|
|
|
attr_reader :module_reference_name
|
|
attr_reader :module_path
|
|
end |