History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: BOO-880
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Marcus Griep
Reporter: Marcus Griep
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Boo

Exception Handling: Allow for exception fault handlers

Created: 27/Sep/07 09:02 PM   Updated: 26/Oct/07 09:20 PM
Component/s: Parser, Emitter, Compiler
Affects Version/s: 0.7.9
Fix Version/s: 0.8.1

Time Tracking:
Not Specified

Issue Links:
Related
 


 Description  « Hide
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


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Marcus Griep - 28/Sep/07 12:19 PM
Fixed ordering of catch/filter versus fault/finally handler. Catch/filter handlers execute before fault/finally handlers.

Marcus Griep - 06/Oct/07 08:15 PM
Patch to fix in related issue.

Marcus Griep - 06/Oct/07 09:57 PM
See related issue for patch

Marcus Griep - 26/Oct/07 09:20 PM
Revision 2744