Skip to content

Commit

Permalink
Properly print out errors thrown by djvulibre's code
Browse files Browse the repository at this point in the history
  • Loading branch information
trufanov-nok committed Jul 28, 2021
1 parent ad4dd91 commit 8f0bf15
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tools/settings-reader/GException.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ void
GException::perror(void) const
{
fflush(0);
DjVuPrintErrorUTF8("*** ");
if (cause)
DjVuPrintErrorUTF8("*** %s\n", cause);
// DjVuMessageLite::perror(get_cause());
if (file && line>0)
DjVuPrintErrorUTF8("*** (%s:%d)\n", file, line);
Expand Down
10 changes: 8 additions & 2 deletions tools/settings-reader/SettingsReaderAdapter.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#include "SettingsReaderAdapter.h"
#include "SettingsReader.h"
#include "GException.h"

int read_app_options_from_file(const char* fname, struct AppOptions* opts)
{
if (opts) {
SettingsReader reader(fname, opts);
return reader.readAllOptions();
G_TRY {
SettingsReader reader(fname, opts);
return reader.readAllOptions();
} G_CATCH(exc) {
exc.perror();
exit(-2);
} G_ENDCATCH;
}

return 0;
Expand Down

0 comments on commit 8f0bf15

Please sign in to comment.