From 8f0bf155521df36fd8573c6ea87fd1b24d49fc90 Mon Sep 17 00:00:00 2001 From: Alexander Trufanov Date: Wed, 28 Jul 2021 18:23:56 +0300 Subject: [PATCH] Properly print out errors thrown by djvulibre's code --- tools/settings-reader/GException.cpp | 3 ++- tools/settings-reader/SettingsReaderAdapter.cpp | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/settings-reader/GException.cpp b/tools/settings-reader/GException.cpp index d6ed2c8..3333cfc 100644 --- a/tools/settings-reader/GException.cpp +++ b/tools/settings-reader/GException.cpp @@ -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); diff --git a/tools/settings-reader/SettingsReaderAdapter.cpp b/tools/settings-reader/SettingsReaderAdapter.cpp index 3ba0be1..8b54d25 100644 --- a/tools/settings-reader/SettingsReaderAdapter.cpp +++ b/tools/settings-reader/SettingsReaderAdapter.cpp @@ -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;