On Tue, Feb 17, 2009 at 12:26, Martin Langhoff <martin.langh...@gmail.com> wrote: > On Tue, Feb 17, 2009 at 10:48 PM, Tomeu Vizoso <to...@sugarlabs.org> wrote: >>> Is there a better way? >> >> Sorry about the late reply. I'm having trouble understanding the >> doubt, can you reformulate your question (if it's still valid)? > > Use case: I write my code, adding nice exceptions to handle all the > things that could go wrong. In particular, I want some errors to be > pretty much ignored.
But you want them still logged as errors? I would say for always logging any exceptions that are thrown except in corner cases where you can check before trying if that operation will fail. You can print the stack trace from the handler with traceback.format_exc() > When I start to test and I hit those error conditions. Except that... > as I am developing, I want to say "no no, for now, don't hide them > from me" so I can judge the errors: some may be in my code. > > Anyway, right after I wrote that email I walked into a > Python-Users-Group thing happening at my office. One of them suggested > that I add a bare 'raise' at the end of the exception handling. > Looking at the docs, his recommendation makes sense -- haven't tried > it. That will reraise the exception that is being handled, useful when you want to cleanup something, but then let the exception keep flowing as usual. Regards, Tomeu > cheers, > > > m > -- > martin.langh...@gmail.com > mar...@laptop.org -- School Server Architect > - ask interesting questions > - don't get distracted with shiny stuff - working code first > - http://wiki.laptop.org/go/User:Martinlanghoff > _______________________________________________ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel