[Qt-interest] C++ exceptions don't unwind through QtScript/JS

Thiago Macieira thiago at kde.org
Tue May 17 20:28:02 CEST 2011


On Tuesday, 17 de May de 2011 11:59:00 Eric Miller wrote:
> Hey all -
> 
> We have some C++ code that uses exceptions. We have a catch block in our
> QApplication::notify override that will catch anything not caught higher
> up. However, as we've started calling QObject slots from QtWebKit
> Javascript and QtScript code, we've discovered that exceptions do not cross
> the JS/QtScript layers. The app will terminate as if there were no catch
> block, even though it is in fact still there at the bottom of the stack.
> 
> I know Qt is not generally exception-friendly, but is there any good way to
> deal with this? Converting the C++ exception into a QtScript/JS exception
> would be ideal, but at least getting the exception to unwind through
> JS/QtScript would save some trouble.

Catch all of your exceptions before a language transition occurs.

Sorry, no exceptions (no pun intended).

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110517/cc63c8d1/attachment.bin 


More information about the Qt-interest-old mailing list