Re: [Pyobjc-dev] ObjC exceptions, Python exceptions, the event loop
Brought to you by:
ronaldoussoren
From: Just v. R. <ju...@le...> - 2003-01-18 13:50:28
|
Ronald Oussoren wrote: > > On Saturday, Jan 18, 2003, at 13:06 Europe/Amsterdam, Just van Rossum > wrote: > > > I'm wondering about ObjC exceptions: if an app throws an exception, > > could it be caught by the code that invokes the event loop? Hm, > > considering the call stack, I would think so. If this is indeed so, > > I would suggest to catch all exceptions in the > > AppKit.NSApplicationMain wrapper and convert it to a Python > > exception. Since the main program is a Python program, it makes > > sense for it to end as a real Python program instead of "crashing". > > Your right. Somehow I forgot to add a try-block around the call to > NSApplicationMain. The core module already does this for methodcalls. > > > Additionally, if the exception is OC_PythonException, the > > _original_ Python exception should be reraised, resulting in a > > decent traceback. > The support-code for exceptions in objc_util.m should do that, but > I'm not entirely sure if we raise the same exception or a copy of it. I've had a look, and adding the proper handlers to the NSApplicationMain wrapper is straightforward. However, I'm not getting what I expected: the traceback only shows the part in the main program. I'll investigate and patch what I can. Just |