mirror of https://github.com/qt/qtgrpc.git
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:
parent
84a9369496
commit
636b70f93d
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue