diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2013-06-02 13:47:19 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-02-15 15:21:54 +0100 |
commit | 8046e11445ba71b767d4fde08ce1e43e0dcd0359 (patch) | |
tree | d6991bb858a91336e76831b8dbd39c28345f21a9 /src/main.cpp | |
parent | 78ad52e40992d6e68238dc1574d4ae6c6f922d27 (diff) | |
download | sciteco-8046e11445ba71b767d4fde08ce1e43e0dcd0359.tar.gz |
use GLib's GError information to yield errors
* results in better error messages, e.g. when opening files
* the case that a file to be opened (EB) exists but is not readably is handled for the first time
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index ce2cdb4..974aed2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -185,6 +185,8 @@ process_options(int &argc, char **&argv) {NULL} }; + GError *gerror = NULL; + GOptionContext *options; GOptionGroup *interface_group = interface.get_options(); @@ -194,8 +196,9 @@ process_options(int &argc, char **&argv) if (interface_group) g_option_context_add_group(options, interface_group); - if (!g_option_context_parse(options, &argc, &argv, NULL)) { - g_printf("Option parsing failed!\n"); + if (!g_option_context_parse(options, &argc, &argv, &gerror)) { + g_fprintf(stderr, "Option parsing failed: %s\n", + gerror->message); exit(EXIT_FAILURE); } |