Invoking a custom exception in Python
Posted: Mon Jan 21, 2008 10:39 pm
Hi All,
Can someone please point me in the right direction with regards to invoking a custom exception in python? For example, if I try to pop an stack that doesn't have any values, python throws an exception called IndexError. What if I want it to invoke MyError (which is a programmer-defined subclass of Exception)? This is driving me up the wall and the python manual is no help.
Help is appreciated.
Can someone please point me in the right direction with regards to invoking a custom exception in python? For example, if I try to pop an stack that doesn't have any values, python throws an exception called IndexError. What if I want it to invoke MyError (which is a programmer-defined subclass of Exception)? This is driving me up the wall and the python manual is no help.