Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Created on 12.09.2012
- @author: Mars83
- '''
- class MyOwnError(Exception):
- """ This class represents a custom error. """
- def __init__(self, value):
- """ Ctor of MyOwnError. """
- self.value = value
- def __str__(self):
- """ toString method of MyOwnError. """
- return repr(self.value)
- try:
- raise MyOwnError("my own error raised")
- except MyOwnError as moe:
- print(moe)
- try:
- 2/0
- except ZeroDivisionError as zde:
- print(zde)
- try:
- open("")
- except IOError as ioe:
- print(ioe)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement