Exception: MadderLib::Error

Inherits:
Exception
  • Object
show all
Defined in:
lib/madderlib/core.rb

Overview

Error

A Module-specific Exception class

– i would have called it MadderLib::Exception except that i don’t know how to access Kernel::Exception within the initialize logic ++

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, cause = nil) ⇒ Error

Constructed with a message and an optional ‘causing’ Exception.

If no message is passed – eg. only an Exception – then this Error inherits its message.



17
18
19
20
21
22
23
24
25
# File 'lib/madderlib/core.rb', line 17

def initialize(message, cause=nil)
	if (Exception === message)
		super message.to_s
		@cause = message
	else
		super message
		@cause = cause
	end
end

Instance Attribute Details

#causeObject (readonly)

The propagated cause of this Exception, if appropriate



12
13
14
# File 'lib/madderlib/core.rb', line 12

def cause
  @cause
end