aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/protobuf/util
diff options
context:
space:
mode:
authorulanovgeorgiy <ulanovgeorgiy@yandex-team.com>2023-02-02 15:45:06 +0300
committerulanovgeorgiy <ulanovgeorgiy@yandex-team.com>2023-02-02 15:45:06 +0300
commit4676a64273b09b50f84bd7bc93a1ce598512f136 (patch)
treee61825a8073060303ddcba6658d6a13b90f85055 /library/cpp/protobuf/util
parentd356fcb037bfbba8740bde2db0f51a8b4aaa9128 (diff)
downloadydb-4676a64273b09b50f84bd7bc93a1ce598512f136.tar.gz
enabling writing error message to exception in the default
Diffstat (limited to 'library/cpp/protobuf/util')
-rw-r--r--library/cpp/protobuf/util/pb_io.cpp4
-rw-r--r--library/cpp/protobuf/util/pb_io.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/library/cpp/protobuf/util/pb_io.cpp b/library/cpp/protobuf/util/pb_io.cpp
index 3ec95f0a9b..92f3675b53 100644
--- a/library/cpp/protobuf/util/pb_io.cpp
+++ b/library/cpp/protobuf/util/pb_io.cpp
@@ -180,7 +180,7 @@ void ParseFromTextFormat(IInputStream& in, NProtoBuf::Message& m,
NProtoBuf::TextFormat::Parser p;
ConfigureParser(options, p);
- bool writeErrorToException = options & EParseFromTextFormatOption::WriteErrorMessageToException;
+ bool writeErrorToException = !(options & EParseFromTextFormatOption::ForceWriteParsingErrorsToCerr);
TStringStream errorLog;
THolder<TErrorCollector> errorCollector;
@@ -195,7 +195,7 @@ void ParseFromTextFormat(IInputStream& in, NProtoBuf::Message& m,
if (!p.Parse(&adaptor, &m)) {
// remove everything that may have been read
m.Clear();
- if (Y_UNLIKELY(writeErrorToException)) {
+ if (Y_LIKELY(writeErrorToException)) {
ythrow yexception() << errorLog.Str();
} else {
ythrow yexception() << "ParseFromTextFormat failed on Parse for " << m.GetTypeName();
diff --git a/library/cpp/protobuf/util/pb_io.h b/library/cpp/protobuf/util/pb_io.h
index 04c6ebb305..e10cee8a37 100644
--- a/library/cpp/protobuf/util/pb_io.h
+++ b/library/cpp/protobuf/util/pb_io.h
@@ -59,8 +59,8 @@ void SerializeToTextFormatWithEnumId(const NProtoBuf::Message& m, IOutputStream&
enum class EParseFromTextFormatOption : ui64 {
// Unknown fields will be ignored by the parser
AllowUnknownField = 1,
- // Error message will be writen to exception message instead of cerr
- WriteErrorMessageToException = 2
+ // Error message will be will be written to stderr in the original format
+ ForceWriteParsingErrorsToCerr = 2
};
Y_DECLARE_FLAGS(EParseFromTextFormatOptions, EParseFromTextFormatOption);