>>> class FooException(Exception): pass ... >>> >>> try: ... raise FooException('Hello there') ... except FooException, data: ... print data ... Hello there