This question refers to an answer here. I need to access message
of a custom exception. Is this possible?
I thought that directly calling message
will suffice as in this example:
class MyCustomError < StandardError
attr_reader :object
def initialize(object)
@object = object
puts message
end
end
but this is not what I expected it to be. It gave me some string like:
"MyModuleNameHere::MyCustomExceptionClassNameHere"
instead of:
"a message"
My intuition is leaning towards no, since the initialize
constructor does not take the "a message"
text.