diff options
| author | Christian Kandeler <christian.kandeler@digia.com> | 2013-09-24 10:35:25 +0200 |
|---|---|---|
| committer | Joerg Bornemann <joerg.bornemann@digia.com> | 2013-09-24 12:54:38 +0200 |
| commit | 3550fdde90790fed8c798e64639b9ad2b7d13356 (patch) | |
| tree | ffbf312e55514caeaa4eb0a56e5c42fce4ebe1aa /src/lib/tools | |
| parent | a75c868a87429ed3fb68ff38d2ad6a433594418a (diff) | |
| download | qbs-3550fdde90790fed8c798e64639b9ad2b7d13356.tar.gz | |
Do not store the build graph after an internal error.
If we get an assert, we will most likely want to investigate it further,
e.g. by re-running the build with more debug information etc. However,
if we store the build graph, the input parameters for the second run
will not be the same anymore, and we might not get the same error again.
So we don't touch the build graph in that case to have a more
deterministic behavior.
Change-Id: Ib4d2ce74d280b2700705b06556fc786b51378fda
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/lib/tools')
| -rw-r--r-- | src/lib/tools/error.cpp | 15 | ||||
| -rw-r--r-- | src/lib/tools/error.h | 4 | ||||
| -rw-r--r-- | src/lib/tools/qbsassert.cpp | 2 |
3 files changed, 18 insertions, 3 deletions
diff --git a/src/lib/tools/error.cpp b/src/lib/tools/error.cpp index c2a80023c..23045a08e 100644 --- a/src/lib/tools/error.cpp +++ b/src/lib/tools/error.cpp @@ -109,7 +109,10 @@ QString ErrorItem::toString() const class ErrorInfo::ErrorInfoPrivate : public QSharedData { public: + ErrorInfoPrivate() : internalError(false) { } + QList<ErrorItem> items; + bool internalError; }; /*! @@ -127,9 +130,11 @@ ErrorInfo::ErrorInfo(const ErrorInfo &rhs) : d(rhs.d) { } -ErrorInfo::ErrorInfo(const QString &description, const CodeLocation &location) : d(new ErrorInfoPrivate) +ErrorInfo::ErrorInfo(const QString &description, const CodeLocation &location, bool internalError) + : d(new ErrorInfoPrivate) { append(description, location); + d->internalError = internalError; } ErrorInfo &ErrorInfo::operator =(const ErrorInfo &other) @@ -180,4 +185,12 @@ QString ErrorInfo::toString() const return lines.join(QLatin1String("\n")); } +/*! + * \brief Returns true if this error represents a bug in qbs, false otherwise. + */ +bool ErrorInfo::isInternalError() const +{ + return d->internalError; +} + } // namespace qbs diff --git a/src/lib/tools/error.h b/src/lib/tools/error.h index 9b40d0560..d797de319 100644 --- a/src/lib/tools/error.h +++ b/src/lib/tools/error.h @@ -69,7 +69,8 @@ class QBS_EXPORT ErrorInfo public: ErrorInfo(); ErrorInfo(const ErrorInfo &rhs); - ErrorInfo(const QString &description, const CodeLocation &location = CodeLocation()); + ErrorInfo(const QString &description, const CodeLocation &location = CodeLocation(), + bool internalError = false); ErrorInfo &operator=(const ErrorInfo &other); ~ErrorInfo(); @@ -79,6 +80,7 @@ public: bool hasError() const { return !items().isEmpty(); } void clear(); QString toString() const; + bool isInternalError() const; private: class ErrorInfoPrivate; diff --git a/src/lib/tools/qbsassert.cpp b/src/lib/tools/qbsassert.cpp index 484b8057c..e66e73bb6 100644 --- a/src/lib/tools/qbsassert.cpp +++ b/src/lib/tools/qbsassert.cpp @@ -43,7 +43,7 @@ void writeAssertLocation(const char *condition, const char *file, int line) void throwAssertLocation(const char *condition, const char *file, int line) { throw ErrorInfo(QString(QLatin1String("ASSERT: %1")).arg(condition), - CodeLocation(QString::fromLocal8Bit(file), line)); + CodeLocation(QString::fromLocal8Bit(file), line), true); } } // namespace Internal |
