Exemple #1
0
static PedExceptionOption
default_handler (PedException* e)
{
	if (e->type == PED_EXCEPTION_BUG)
		fprintf (stderr,
			_("A bug has been detected in GNU Parted.  "
			"Refer to the web site of parted "
			"http://www.gnu.org/software/parted/parted.html "
			"for more information of what could be useful "
			"for bug submitting!  "
			"Please email a bug report to "
			"%s containing at least the "
			"version (%s) and the following message:  "),
			 PACKAGE_BUGREPORT, VERSION);
	else
		fprintf (stderr, "%s: ",
			 ped_exception_get_type_string (e->type));
	fprintf (stderr, "%s\n", e->message);

	switch (e->options) {
		case PED_EXCEPTION_OK:
		case PED_EXCEPTION_CANCEL:
		case PED_EXCEPTION_IGNORE:
			return e->options;

		default:
			return PED_EXCEPTION_UNHANDLED;
	}
}
Exemple #2
0
PedExceptionOption
_test_exception_handler (PedException* e)
{
        fail ("Exception of type %s has been raised: %s",
              ped_exception_get_type_string (e->type),
              e->message);

        return PED_EXCEPTION_UNHANDLED;
}
Exemple #3
0
Fichier : ui.c Projet : bcl/parted
static void
_print_exception_text (PedException* ex)
{
        StrList*    text;

        wipe_line ();

        if (ex->type == PED_EXCEPTION_BUG) {
                fprintf (stderr, bug_msg, VERSION);
                text = str_list_create ("\n", ex->message, "\n\n", NULL);
        } else {
                text = str_list_create (
                           _(ped_exception_get_type_string (ex->type)),
                           ": ", ex->message, "\n", NULL);
        }

        str_list_print_wrap (text, screen_width (), 0, 0, stderr);
        str_list_destroy (text);
}