Re: Exception handling (was: Quickies about the new GObject)
- From: Derek Simkowiak <dereks kd-dev com>
- To: Havoc Pennington <hp redhat com>
- Cc: gtk-devel-list redhat com
- Subject: Re: Exception handling (was: Quickies about the new GObject)
- Date: Thu, 1 Jun 2000 13:25:36 -0700 (PDT)
-> 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]