Re: lecture about error handling



Amen! now can we make that a one liner so people will actually do it?

-Seth

On Sun, 2002-05-26 at 08:24, Havoc Pennington wrote:
> 
> Hi,
> 
> WRONG:
>  
>                 gnome_help_display_desktop (NULL,
>                          "control-center-manual",
>                         "config-mouse.xml",
>                         "CONFIGURATION", &error);
>                 if (error) {
>                         g_warning ("help error: %s\n",
>                         error->message);
>                         g_error_free (error);
>                 }
> 
> RIGHT:
> 
>       err = NULL;
>       gnome_help_display ("gnome-terminal", "gnome-terminal-prefs",
>                           &err);
> 
>       if (err)
>         {
>           GtkWidget *dialog;
> 
>           dialog = gtk_message_dialog_new (GTK_WINDOW (editor),
>                                            GTK_DIALOG_DESTROY_WITH_PARENT,
>                                            GTK_MESSAGE_ERROR,
>                                            GTK_BUTTONS_CLOSE,
>                                            _("There was an error
>                                            displaying help: %s"),
>                                            err->message);
> 
>           g_signal_connect (G_OBJECT (dialog), "response",
>                             G_CALLBACK (gtk_widget_destroy),
>                             NULL);
> 
>           gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
> 
>           gtk_widget_show (dialog);
> 
>           g_error_free (err);
>         }
> 
> Havoc
> _______________________________________________
> desktop-devel-list mailing list
> desktop-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/desktop-devel-list





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