#!/usr/bin/env python
class MyException( Exception):
def __init__( self, *argin):
self.value = argin
def __str__( self):
return repr( self.value)
try:
raise MyException( "this", "is", "an", "exception")
except MyException as e:
# referencing value member explicitly
print( "caught exception ", e.value)
# using __str__ function member
print( "caught exception ", e)