Boo

Exception Handling: Allow for exception filters

Details

  • Type: New Feature New Feature
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 0.7.9
  • Fix Version/s: 0.8.1
  • Component/s: Compiler, Emitter, Parser
  • Labels:
    None
  • Testcase included:
    yes
  • Patch Submitted:
    Yes
  • Number of attachments :
    3

Description

The CLI currently provides a mechanism, 'filter', so that it will only handle an exception if a condition holds:

For an example: http://dotnet.org.za/armand/archive/2005/11/09/48087.aspx and http://www.microsoft.com/mspress/books/sampchap/5771.aspx

proposed syntax:

except ex as SomeException if arg is not null:
  print "arg is not null, so I'll handle it"
except as SomeException if ItDidntWork():
  print "It Didn't Work, but I'll handle it."
except unless boolArg:
  print "boolArg was true, so I'll handle it."
  1. exception.patch
    07/Oct/07 11:55 AM
    27 kB
    Marcus Griep
  2. exception.redux.patch
    25/Oct/07 4:51 PM
    27 kB
    Marcus Griep
  3. exceptions.redux2.patch
    26/Oct/07 12:24 PM
    45 kB
    Marcus Griep

Issue Links

Activity

Hide
Marcus Griep added a comment -

A smaller, more succinct, and complete patch file for all linked exception issues.

Show
Marcus Griep added a comment - A smaller, more succinct, and complete patch file for all linked exception issues.
Hide
Marcus Griep added a comment -

Modified cases to use (if/unless) now that when is no longer reserved. New patch to be uploaded soon.

Show
Marcus Griep added a comment - Modified cases to use (if/unless) now that when is no longer reserved. New patch to be uploaded soon.
Hide
Marcus Griep added a comment -

New patch with linked up tests.

Show
Marcus Griep added a comment - New patch with linked up tests.
Hide
Rodrigo B. de Oliveira added a comment -

Could you use Declaration with a null name instead of adding a TypeReference field to ExceptionHandler?

Show
Rodrigo B. de Oliveira added a comment - Could you use Declaration with a null name instead of adding a TypeReference field to ExceptionHandler?
Hide
Marcus Griep added a comment -

Updated to no longer use a TypeReference in the Exception Handler and to properly implement "Option B" (Fault block executes on uncaught exceptions, before finally). Includes comments in Emit Assembly detailing workaround necessary due to shortcoming in Reflection.Emit.ILGenerator.

Show
Marcus Griep added a comment - Updated to no longer use a TypeReference in the Exception Handler and to properly implement "Option B" (Fault block executes on uncaught exceptions, before finally). Includes comments in Emit Assembly detailing workaround necessary due to shortcoming in Reflection.Emit.ILGenerator.
Hide
Marcus Griep added a comment -

Small fix. (Accidentally included non-germane patch stuffs)

Show
Marcus Griep added a comment - Small fix. (Accidentally included non-germane patch stuffs)
Hide
Marcus Griep added a comment -

Complete and fully re-tested. (Why do patch files have to be so picky )

Show
Marcus Griep added a comment - Complete and fully re-tested. (Why do patch files have to be so picky )
Hide
Marcus Griep added a comment -

Revision 2744

Show
Marcus Griep added a comment - Revision 2744

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: