mirror of
https://github.com/logos-blockchain/logos-blockchain-ui.git
synced 2026-08-08 16:03:17 +00:00
Improve comments.
This commit is contained in:
parent
a6af0e6280
commit
4aec1cc77d
@ -39,9 +39,10 @@ static LogosResult err(const QString& message)
|
|||||||
return LogosResult{false, QVariant(), message};
|
return LogosResult{false, QVariant(), message};
|
||||||
}
|
}
|
||||||
|
|
||||||
// invokeRemoteMethod() returns an invalid QVariant (not a LogosResult) when
|
// Normalises a `QVariant` (e.g. from a `invokeRemoteMethod()`) call to a `LogosResult`.
|
||||||
// the call itself fails to get a reply (timeout, disconnected module, etc.),
|
//
|
||||||
// as opposed to the remote method running and reporting failure normally.
|
// `invokeRemoteMethod()` might return an invalid `QVariant` when the call itself fails to get a reply (e.g.: timeout).
|
||||||
|
// This function normalises the reply for the `LogosResult` case.
|
||||||
static LogosResult toLogosResult(const QVariant& reply)
|
static LogosResult toLogosResult(const QVariant& reply)
|
||||||
{
|
{
|
||||||
if (!reply.isValid())
|
if (!reply.isValid())
|
||||||
@ -54,9 +55,9 @@ static QString toErrorMessage(const LogosResult& result)
|
|||||||
return QStringLiteral("Error: %1").arg(result.error.toString());
|
return QStringLiteral("Error: %1").arg(result.error.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Renders the balance column text in AccountsModel. getBalance() and
|
// Returns a stringified version of a `LogosResult`.
|
||||||
// transferFunds() return the LogosResult itself (see toVariantMap) so QML
|
//
|
||||||
// branches on success/error directly instead of re-parsing a string.
|
// Used in some places that consume the success and error properties in the same manner.
|
||||||
static QString toDisplayMessage(const LogosResult& result)
|
static QString toDisplayMessage(const LogosResult& result)
|
||||||
{
|
{
|
||||||
return result.success ? result.value.toString() : toErrorMessage(result);
|
return result.success ? result.value.toString() : toErrorMessage(result);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user