Re: Exception handling (was: Quickies about the new GObject)



-> The problem is that your error handling is all in some big central
-> error handler callback, and there's no way to handle the exception in
-> the code that caused it. For example:
-> 
-> void
-> my_func ()
-> {
->  open_file(); /* causes exception signal to be emitted */
->  /* now what? we need to say if (failed) */
-> }

	Why not:

void my_func()
{
	failed = open_file(filename);
	if (failed == TRUE) {
		GOpenFailedException* exception_obj;

		exception_obj = g_open_failed_new(filename);
		gtk_signal_emit_by_name(object, "exception", exception_obj);
	}
}






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