On Fri, 2009-05-22 at 10:24 +0200, Dirk Meyer wrote: > That is a bad patch. A broken file can now crash beacon. Let us assume a > MPEG-TS file with some wrong bits and I get an IndexError ... beacon > will crash because nothing catches it. A parser can run into any kind of > bug, we _must_ catch all exceptions and try the next parser.
Ok, fair enough, the commit was not apparently not very well reasoned. I maintain that catching KeyboardInterrupt and SystemExit is wrong, but we do need some way to catch the myriad of errors that could be generated inside a parser so we can move onto the next parser. > Is there any reason why you want to catch an exception outside? Yes. There are a couple exceptions that must be bubbled up. One example is GeneratorExit, although this isn't very important because we're not using generators and coroutines inside Kaa yet. The other one, which is what prompted me to make this change, is InProgressAborted. For threaded callbacks, like what beacon uses for kaa.metadata.parse(), if this exception is caught and ignored, you can't abort the thread. So how about I add the inner catch back, only instead of a catch-all, I catch only Exception, and then subclass InProgressAborted from BaseException. It's not recommended for user exceptions to subclass BaseException, however in Python 2.6 they changed GeneratorExit to subclass BaseException from Exception, and I think the same rationale applies to InProgressAborted. Same with KeyboardInterrupt and SystemExit: these subclass BaseException because they are asynchronous exceptions, like InProgressAborted is (in the thread context). So let me know what you think. That should solve both our complaints. (Then I'll need to fix the various other catch-alls within the metadata parsers. But I needed to do that anyway.) ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://www.creativitycat.com _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel