> I'm trying to handle exceptions on a fltk application under win32 and
> compiled with mingw 4.5.2 but it seems that the exceptions doesn't reach
> the main function, the program allways terminate without the exception
> been caught.
>
> Someone else succeed catching exceptions or have a good strategy to mange
> errors with exception when programming with fltk ?
>

There's nothing obviously wrong with the code you posted.  I use
that sort of structure pretty routinely without any problems.
However, I don't use mingw (I use cygwin with win32) or sqlite3,
so I can't speak directly to the issue.

That said, here are a couple of ways you might troubleshoot it.

- If neither of your catch blocks is being executed (sorry, but
it's not clear from your explanation exactly what's going on),
the obvious explanation is that no exception is in fact being thrown.
To test that theory, throw one yourself from some other translation
unit, maybe from inside load_translations(), or the MainWindow
constructor, and see it it makes it back to main().  If it does,
the issue may be that sqllite3 has been compiled not to throw
exceptions in this environment.

- If instead you're getting into the catch(...) block, where
you expected to be in the catch(CppSqlException &e) block,
the problem may be that the definition of CppSqlException isn't
visible in the translation unit containing main().  You can test
that out by trying to instantiate one in main()
   CppSqlException e ( /* whatever args are required*/ );
If it fails to compile, that's the problem.  (If you're not
allowed to instantiate one of these things, you'll have to
inspect sqlite3.h)

- Finally, you might want to put a try block around the initialization
code.  The fact that your main window appears is good evidence that
no exception has been thrown prior to the try block, but it's not
altogether dispositive.

HTH,
Stan


_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to