3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/xporter_on_demand/exception_factory.rb', line 3
def self.generate_exception(response_hash)
exception_type = response_hash.delete('ExceptionType') || "UnknownError"
message = response_hash.delete('Message')
exception_message = response_hash.delete('ExceptionMessage')
inner_exception = response_hash.delete('InnerException')
unless XporterOnDemand.constants.include? exception_type.to_sym
XporterOnDemand.const_set exception_type, Class.new(Error)
end
blob = " \#{exception_type}\n ==========\n Message: \#{message}\n ExceptionMessage: \#{exception_message}\n InnerException: \#{inner_exception}\n ==========\n ERROR\n\n raise XporterOnDemand.const_get(exception_type).new(blob)\nend\n"
|