Re: Exceptions in gtkmm



Murray,

Thanks for your response.

Murray Cumming wrote:
On Thu, 2008-07-10 at 10:28 -0700, Sohail Somani wrote:
Hey guys,

I'm trying to figure out the policy on exceptions in gtkmm. I notice that, Gtk::Pixbuf throws an exception if you give it a file that doesn't exist. I presume it converts some sort of error code to an exception.

Yes, we generally throw an exception when wrapping a C function that has
a GError output parameter.
What if one of my slots throws an exception?

It shouldn't, because this can't be passed back through a C function
that called your slot. See
http://www.gtkmm.org/docs/gtkmm-2.4/docs/FAQ/html/index.html#id2552300

Sigh, yes I know :-(

Ok how about this: Is there a simple way to wrap each slot so that it is effectively:

try
{
   call_real_slot();
}
catch(type1)
{..}
catch(type2)
{..}

I think it should be possible if I use a wrapper around sigc::slot. What do you think?

All I really care about is being able to report the unhandled exceptions to the user and/or logging them.

Thanks

--
Sohail Somani
http://uint32t.blogspot.com


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