Changes between Version 6 and Version 7 of PythonPort/Design/ErrorReporting


Ignore:
Timestamp:
Oct 28, 2007, 4:02:43 PM (18 years ago)
Author:
ghost
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PythonPort/Design/ErrorReporting

    v6 v7  
    3232== Maintaining user context and handling stray exceptions ==
    3333
    34 '''Todo''': implement function decorator for this
    35 
    3634Any function that does something on interest to user must be written like this:
    3735{{{
     
    5149    self.manager().errors().pop_user_context()
    5250}}}
     51
     52Since writing this all over is not fun, the {{{errors}}} module provides a function decorator {{{user_error_checkpoint}}}, that allows to write your code like this:
     53{{{
     54@user_error_checkpoint
     55def do_something():
     56    self.manager().errors()("doing something")
     57    ....
     58}}}
     59
     60Both approaches above assume that a function only pushes a user context once, if it pushes two nested context the first approach must be extended to use two try/except blocks, or the function split in two.
    5361
    5462== Handling Jam context ==