forked from qt-creator/qt-creator
CmdBridge: Improve error handling
The message result type was checked, but the promise was still finished without an error. Change-Id: Ib5ba5f48202073a82bfbcb871e0d5a5277ea9f2a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -21,8 +21,13 @@
|
|||||||
Q_LOGGING_CATEGORY(clientLog, "qtc.cmdbridge.client", QtWarningMsg)
|
Q_LOGGING_CATEGORY(clientLog, "qtc.cmdbridge.client", QtWarningMsg)
|
||||||
|
|
||||||
#define ASSERT_TYPE(expectedtype) \
|
#define ASSERT_TYPE(expectedtype) \
|
||||||
QTC_ASSERT(map.value("Type").toString() == expectedtype, promise.finish(); \
|
if (map.value("Type").toString() != expectedtype) { \
|
||||||
return JobResult::Done)
|
const QString err = QString("Unexpected result type: %1, expected: %2") \
|
||||||
|
.arg(map.value("Type").toString(), expectedtype); \
|
||||||
|
promise.setException(std::make_exception_ptr(std::runtime_error(err.toStdString()))); \
|
||||||
|
promise.finish(); \
|
||||||
|
return JobResult::Done; \
|
||||||
|
}
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user