Details
Description
The CLI provides the ability similar to 'finally'. Whereas 'finally' runs whether or not a try block exits normally, the 'fault' block only runs if the 'try' block exits abnormally through an exception. Both finally and fault run prior to other handlers.
http://www.microsoft.com/mspress/books/sampchap/5771.aspx
Implementation Notes:
Only one fault handler per try block should be allowed.
A fault handler can appear with a finally handler.
When composed with finally, we should probably enforce that fault should appear first and run before finally.
I recommend taking over the obsolete keyword failure for this use.
Proposed syntax:
try: raise Exception() except: print "Caught" failure: print "Exception thrown" ensure: print "Completed"
This should print:
Caught Exception thrown Completed
Issue Links
- is related to
-
BOO-879
Exception Handling: Allow for exception filters
-