Re: How to rethrow exception or install exception handlers inside Gtk::Main::run



Almost undocumented:

sigc::connection add_exception_handler(const sigc::slot<void>& slot);

In the callback, you can do something like this:
try
{
	throw;
}
catch (Glib::Exception &ex)
{
	std::cerr << "Glib/Gtk error: " << ex.what().c_str() << std::endl;
}
catch (std::exception &ex)
{
	std::cerr << "Unhandled exception: " << ex.what().c_str() << std::endl;
}

yann


On 02/04/11 17:11, Germán Diago wrote:
Hi all. I'm implementing a program with gtkmm and I found that when
throwing an exception from
inside Gtk::Main::run (an exception from my program logic), I can't
catch that exception from my main() function since Glib catches the
exception (I think) and rethrows a Glib::Exception. This way I loose the
information from my exceptions. Is there any workaround to be able to
get my original
exception outside of the main loop? Thank you.
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]