Exception Handling
I LOVE DOING THIS :)
If at any point in the program an Error occurs, then the program should exit gracefully
Exceptions are raised when an external event occurs which in some way changes the normal flow of the program
How to Handle Exceptions
Put the unsafe code in
Try:
blockPut the fall-back code in
Except:
blockPut the final code in
Finally:
block
Exceptions can also be raised if you want the code to behave within specific parameters
User Defined Exceptions
Writing a sample program which detects the Disallow
tag in the robots.txt
and raises an User-Defined Exception
Last updated