summaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf
diff options
context:
space:
mode:
authormag1str0 <[email protected]>2025-12-02 00:25:51 +0300
committermag1str0 <[email protected]>2025-12-02 01:11:18 +0300
commitce886fbefdd5ca3aeb82f1c9f7755e22f1bfbe49 (patch)
tree02dee97e9aa357e33dd9080ba8b5326e8f5b3f7a /library/cpp/protobuf
parentb20d3ef4dc88ad6e97f69006b213bb4fcd93b9c7 (diff)
Fix protobuf text serialization error handling
commit_hash:7aa64b77859b5f8f830901df680f57049ccd30ac
Diffstat (limited to 'library/cpp/protobuf')
-rw-r--r--library/cpp/protobuf/util/pb_io.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/cpp/protobuf/util/pb_io.cpp b/library/cpp/protobuf/util/pb_io.cpp
index 77ee1c60684..3c08750ea7f 100644
--- a/library/cpp/protobuf/util/pb_io.cpp
+++ b/library/cpp/protobuf/util/pb_io.cpp
@@ -133,7 +133,7 @@ int operator&(NProtoBuf::Message& m, IBinSaver& f) {
void SerializeToTextFormat(const NProtoBuf::Message& m, IOutputStream& out) {
NProtoBuf::io::TCopyingOutputStreamAdaptor adaptor(&out);
- if (!NProtoBuf::TextFormat::Print(m, &adaptor)) {
+ if (!NProtoBuf::TextFormat::Print(m, &adaptor) || !adaptor.Flush()) {
ythrow yexception() << "SerializeToTextFormat failed on Print";
}
}
@@ -150,7 +150,7 @@ void SerializeToTextFormatWithEnumId(const NProtoBuf::Message& m, IOutputStream&
printer.SetDefaultFieldValuePrinter(new NProtoBuf::TEnumIdValuePrinter());
NProtoBuf::io::TCopyingOutputStreamAdaptor adaptor(&out);
- if (!printer.Print(m, &adaptor)) {
+ if (!printer.Print(m, &adaptor) || !adaptor.Flush()) {
ythrow yexception() << "SerializeToTextFormatWithEnumId failed on Print";
}
}
@@ -162,7 +162,7 @@ void SerializeToTextFormatPretty(const NProtoBuf::Message& m, IOutputStream& out
NProtoBuf::io::TCopyingOutputStreamAdaptor adaptor(&out);
- if (!printer.Print(m, &adaptor)) {
+ if (!printer.Print(m, &adaptor) || !adaptor.Flush()) {
ythrow yexception() << "SerializeToTextFormatPretty failed on Print";
}
}