[Sugar-devel] Ignoring certain exceptions while debugging...?
Martin Langhoff
martin.langhoff at gmail.com
Tue Feb 17 06:46:28 EST 2009
On Wed, Feb 18, 2009 at 12:39 AM, Tomeu Vizoso <tomeu at sugarlabs.org> wrote:
> On Tue, Feb 17, 2009 at 12:26, Martin Langhoff
> <martin.langhoff at gmail.com> wrote:
>> On Tue, Feb 17, 2009 at 10:48 PM, Tomeu Vizoso <tomeu at 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?
Yes. Log something, keep rolling with the good times.
> 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()
Ah, good trick. Probably that'd saved the day too.
> 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.
Yep - sounds reasonable.
thanks!
m
--
martin.langhoff at gmail.com
martin at 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
More information about the Sugar-devel
mailing list