QGrpcOperation: expose deserializationError, deserializationErrorSring

Expose 'deserializationError' and 'deserializationErrorString', as this
will be needed by the following commit, that changes the error handling
for the read() functions.

An API user could probably need the information of the failed
deserialization.

Change-Id: I0a61b6e4d8d9528c1a9fb45284bcbef6887fb527
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Dennis Oberst 2024-04-11 14:28:31 +02:00
parent 84a9369496
commit 636b70f93d
2 changed files with 33 additions and 0 deletions

View File

@ -133,6 +133,36 @@ void QGrpcOperation::read(QProtobufMessage *message) const
}
}
/*!
\since 6.8
Returns the last deserialization error.
\sa QAbstractProtobufSerializer::deserializationError
*/
QAbstractProtobufSerializer::DeserializationError QGrpcOperation::deserializationError() const
{
const auto ser = d_func()->channelOperation->serializer();
if (!ser)
return QAbstractProtobufSerializer::NoDeserializerError;
return ser->deserializationError();
}
/*!
\since 6.8
Returns the last deserialization error string.
\sa QAbstractProtobufSerializer::deserializationErrorString
*/
QString QGrpcOperation::deserializationErrorString() const
{
const auto ser = d_func()->channelOperation->serializer();
if (!ser)
return QStringLiteral("serializer not available");
return ser->deserializationErrorString();
}
/*!
Getter of the metadata received from the channel. For the HTTP2 channels it
usually contains the HTTP headers received from the server.

View File

@ -36,6 +36,9 @@ public:
void read(QProtobufMessage *message) const;
[[nodiscard]] QAbstractProtobufSerializer::DeserializationError deserializationError() const;
[[nodiscard]] QString deserializationErrorString() const;
[[nodiscard]] const QGrpcMetadata &metadata() const noexcept;
[[nodiscard]] QLatin1StringView method() const noexcept;