adding more details to Exception object

I know that the default ruby Exception object holds message and

Sometimes I want to specify variable names and values to the Exception
object so that I can email myself the details in the exception_notifier.

I know I could subclass Exception to add more details to it, but I dont
want to have to recreate all the classes for exceptions that already
exist (ArgumentError,IOError, etc).

I also know that I could tack on all the info in the message but that
would get very messy since the message is usually in the subject of my
error emails.

I want to be able to do :

raise, details)

Should I try something like

class Exception
attr_accessor :details
def initialize(msg, details)


which probably wont work since its a builtin function and there is only
stub code for it.

Make your own exception:

class CustomException < StandardError
    attr :message, :details
    def initialize(message, details)
    @message = message
    @details = details