IOS: Unify error handling

Instead of using some flags in some struct, we convert the error handling
to use expected_str<ResponseData> to clean up the error handling with
the outside.

Change-Id: I0f8d10c99715989e0069568ebc1d799d412a0600
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-10-31 09:58:23 +01:00
parent e562caaff2
commit 32f69227f1
6 changed files with 143 additions and 145 deletions

View File

@@ -94,15 +94,15 @@ void SimulatorOperationDialog::addMessage(const QString &message, Utils::OutputF
}
void SimulatorOperationDialog::addMessage(const SimulatorInfo &siminfo,
const SimulatorControl::ResponseData &response,
const QString &context)
const SimulatorControl::Response &response,
const QString &context)
{
QTC_CHECK(siminfo.identifier == response.simUdid);
if (response.success) {
if (response) {
QTC_CHECK(siminfo.identifier == response->simUdid);
addMessage(Tr::tr("%1, %2\nOperation %3 completed successfully.").arg(siminfo.name)
.arg(siminfo.runtimeName).arg(context), Utils::StdOutFormat);
} else {
QString erroMsg = response.commandOutput.trimmed();
QString erroMsg = response.error();
QString message = Tr::tr("%1, %2\nOperation %3 failed.\nUDID: %4\nError: %5").arg(siminfo.name)
.arg(siminfo.runtimeName).arg(context).arg(siminfo.identifier)
.arg(erroMsg.isEmpty() ? Tr::tr("Unknown") : erroMsg);