Changes between Version 6 and Version 7 of PythonPort/Design/ErrorReporting
- Timestamp:
- Oct 28, 2007, 4:02:43 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PythonPort/Design/ErrorReporting
v6 v7 32 32 == Maintaining user context and handling stray exceptions == 33 33 34 '''Todo''': implement function decorator for this35 36 34 Any function that does something on interest to user must be written like this: 37 35 {{{ … … 51 49 self.manager().errors().pop_user_context() 52 50 }}} 51 52 Since 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 55 def do_something(): 56 self.manager().errors()("doing something") 57 .... 58 }}} 59 60 Both 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. 53 61 54 62 == Handling Jam context ==
