aboutsummaryrefslogtreecommitdiff
path: root/src/libmain
diff options
context:
space:
mode:
authorBen Burdette <bburdette@gmail.com>2020-05-04 13:46:15 -0600
committerBen Burdette <bburdette@gmail.com>2020-05-04 13:46:15 -0600
commit9c5ece44a7f32784dd5e2ea0faf110054f9233a8 (patch)
tree8c1cc6bef470dfd9af6838456d2e5130e04ba637 /src/libmain
parentc05f0e3093d4fa4ea9b07b038099ff9555258717 (diff)
separate msgs instead of appending to what()
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/shared.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 5773d90cc..db1e0ba1d 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -298,23 +298,21 @@ int handleExceptions(const string & programName, std::function<void()> fun)
} catch (Exit & e) {
return e.status;
} catch (UsageError & e) {
- // TODO: switch to logError
- // logError(e.info());
- _printError(
- format("%1%\nTry '%2% --help' for more information.")
- % e.what() % programName);
+ logError(e.info());
+ printError("Try '%1% --help' for more information.", programName);
return 1;
} catch (BaseError & e) {
- // logError(e.info());
- _printError("%1%%2%", (settings.showTrace ? e.prefix() : ""), e.msg());
+ if (settings.showTrace && e.prefix() != "")
+ printError(e.prefix());
+ logError(e.info());
if (e.prefix() != "" && !settings.showTrace)
- _printError("(use '--show-trace' to show detailed location information)");
+ printError("(use '--show-trace' to show detailed location information)");
return e.status;
} catch (std::bad_alloc & e) {
- _printError(error + "out of memory");
+ printError(error + "out of memory");
return 1;
} catch (std::exception & e) {
- _printError(error + e.what());
+ printError(error + e.what());
return 1;
}