@@ -746,11 +746,8 @@ bool TCommandExecuteQuery::PrintQueryResponse(TIterator& result) {
746
746
747
747
while (!IsInterrupted ()) {
748
748
auto streamPart = result.ReadNext ().GetValueSync ();
749
- if (!streamPart.IsSuccess ()) {
750
- if (streamPart.EOS ()) {
751
- break ;
752
- }
753
- ThrowOnError (streamPart);
749
+ if (ThrowOnErrorAndCheckEOS (streamPart)) {
750
+ break ;
754
751
}
755
752
756
753
if (streamPart.HasResultSet ()) {
@@ -896,11 +893,8 @@ int TCommandExplain::Run(TConfig& config) {
896
893
SetInterruptHandlers ();
897
894
while (!IsInterrupted ()) {
898
895
auto tablePart = result.ReadNext ().GetValueSync ();
899
- if (!tablePart.IsSuccess ()) {
900
- if (tablePart.EOS ()) {
901
- break ;
902
- }
903
- ThrowOnError (tablePart);
896
+ if (ThrowOnErrorAndCheckEOS (tablePart)) {
897
+ break ;
904
898
}
905
899
if (tablePart.HasQueryStats ()) {
906
900
auto proto = NYdb::TProtoAccessor::GetProto (tablePart.GetQueryStats ());
@@ -939,11 +933,8 @@ int TCommandExplain::Run(TConfig& config) {
939
933
SetInterruptHandlers ();
940
934
while (!IsInterrupted ()) {
941
935
auto tablePart = result.ReadNext ().GetValueSync ();
942
- if (!tablePart.IsSuccess ()) {
943
- if (tablePart.EOS ()) {
944
- break ;
945
- }
946
- ThrowOnError (tablePart);
936
+ if (ThrowOnErrorAndCheckEOS (tablePart)) {
937
+ break ;
947
938
}
948
939
if (tablePart.GetStats ()) {
949
940
auto proto = NYdb::TProtoAccessor::GetProto (*tablePart.GetStats ());
@@ -1179,12 +1170,9 @@ void TCommandReadTable::PrintResponse(NTable::TTablePartIterator& result) {
1179
1170
1180
1171
while (!IsInterrupted ()) {
1181
1172
auto tablePart = result.ReadNext ().GetValueSync ();
1182
- if (!tablePart.IsSuccess ()) {
1183
- if (tablePart.EOS ()) {
1173
+ if (ThrowOnErrorAndCheckEOS (tablePart)) {
1184
1174
break ;
1185
1175
}
1186
- ThrowOnError (tablePart);
1187
- }
1188
1176
if (CountOnly) {
1189
1177
TResultSetParser parser (tablePart.ExtractPart ());
1190
1178
while (parser.TryNextRow ()) {
0 commit comments