Question regarding exceptions

Is there any way to catch an error at any point in my code without putting all my code in try blocks, which would be an eyesore?

Thx, xboxjoshone

You can put one try…except around the run() loop.


Thanks, David, I’ll try that.

I had a flash of inspiration and thought, wouldn’t it be cool to have error handling built into DirectObject/Showbase/Messenger?

I mean, it could be like this:


Gee, I don’t know; usually you want more localized exception handling. How can you write a handleError() function that can realistically handle any error your program might throw anywhere?

But if you really want something like that you can do it yourself easily, with your own try…except around the run() statement.


Yeah, I see your point…

Thanks for the tips, I was writing a function that dumps errors and stuff to an stderr.txt.