diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-05-09 08:05:00 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-05-09 22:30:07 +0000 |
commit | 84f28cd664241893a0f5923f415c9930176cb37e (patch) | |
tree | 3cec2d9e5ce08e8defa754d8f19651355a7021fa | |
parent | 69830ed595bfe50686a3d6934e2df69ba4ea4989 (diff) |
shiboken6: Improve exception messages
Print application name and error prefix in exception handler, so
that it is easier to spot them in log files.
Change-Id: I6a14b2f5ee1e5e60e64b473d622dc3cec74473f3
Reviewed-by: Christian Tismer <tismer@stackless.com>
(cherry picked from commit 6666ea1ef5f38f5f13d018c92a3be6b7a1b97303)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | sources/shiboken6/generator/main.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sources/shiboken6/generator/main.cpp b/sources/shiboken6/generator/main.cpp index 037a13130..db4f5435e 100644 --- a/sources/shiboken6/generator/main.cpp +++ b/sources/shiboken6/generator/main.cpp @@ -53,6 +53,7 @@ static inline QString skipDeprecatedOption() { return QStringLiteral("skip-depre static inline QString printBuiltinTypesOption() { return QStringLiteral("print-builtin-types"); } static const char helpHint[] = "Note: use --help or -h for more information.\n"; +static const char appName[] = "shiboken"; using OptionDescriptions = Generator::OptionDescriptions; @@ -410,7 +411,7 @@ void printUsage() static inline void printVerAndBanner() { - std::cout << "shiboken v" SHIBOKEN_VERSION << std::endl; + std::cout << appName << " v" << SHIBOKEN_VERSION << std::endl; std::cout << "Copyright (C) 2016 The Qt Company Ltd." << std::endl; } @@ -418,7 +419,7 @@ static inline void errorPrint(const QString &s) { QStringList arguments = QCoreApplication::arguments(); arguments.pop_front(); - std::cerr << "shiboken: " << qPrintable(s) << "\nCommand line:\n"; + std::cerr << appName << ": " << qPrintable(s) << "\nCommand line:\n"; for (const auto &argument : arguments) std::cerr << " \"" << qPrintable(argument) << "\"\n"; } @@ -771,7 +772,7 @@ int main(int argc, char *argv[]) try { ex = shibokenMain(argc, argv); } catch (const std::exception &e) { - std::cerr << e.what() << std::endl; + std::cerr << appName << " error: " << e.what() << std::endl; ex = EXIT_FAILURE; } return ex; |