diff options
| author | YDBot <[email protected]> | 2025-10-07 00:52:12 +0000 |
|---|---|---|
| committer | YDBot <[email protected]> | 2025-10-07 00:52:12 +0000 |
| commit | 0f7e91aa5ae33d20f2ef0d5cb2c80bb66924417f (patch) | |
| tree | 6307f61a54aea3be0afeeaf766a30597fe047e81 /yql/essentials/parser/common/error.cpp | |
| parent | 86c7a4b4c37e709428ebc61fb8a6e79c7260374c (diff) | |
| parent | 3ab4f52f9654e20e38084313aa6861cb0c17eb1d (diff) | |
Sync branches 251007-0050
Diffstat (limited to 'yql/essentials/parser/common/error.cpp')
| -rw-r--r-- | yql/essentials/parser/common/error.cpp | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/yql/essentials/parser/common/error.cpp b/yql/essentials/parser/common/error.cpp index 9fad2892213..b6b087631c7 100644 --- a/yql/essentials/parser/common/error.cpp +++ b/yql/essentials/parser/common/error.cpp @@ -14,35 +14,29 @@ namespace NAST { } void IErrorCollector::Error(ui32 line, ui32 col, const TString& message) { - if (NumErrors_ + 1 == MaxErrors_) { - AddError(0, 0, "Too many errors"); - ++NumErrors_; - } - - if (NumErrors_ >= MaxErrors_) { - ythrow TTooManyErrors() << "Too many errors"; - } - + GuardTooManyErrors(); AddError(line, col, message); ++NumErrors_; } - TErrorOutput::TErrorOutput(IOutputStream& err, const TString& name, size_t maxErrors) - : IErrorCollector(maxErrors) - , Err(err) - , Name(name) - { + void IErrorCollector::Report(NYql::TIssue&& issue) { + GuardTooManyErrors(); + bool isError = issue.GetSeverity() >= NYql::TSeverityIds::S_WARNING; + AddIssue(std::forward<NYql::TIssue>(issue)); + if (isError) { + ++NumErrors_; + } } - TErrorOutput::~TErrorOutput() - { - } + void IErrorCollector::GuardTooManyErrors() { + if (NumErrors_ + 1 == MaxErrors_) { + AddError(0, 0, "Too many errors"); + ++NumErrors_; + } - void TErrorOutput::AddError(ui32 line, ui32 col, const TString& message) { - if (!Name.empty()) { - Err << "Query " << Name << ": "; + if (NumErrors_ >= MaxErrors_) { + ythrow TTooManyErrors() << "Too many errors"; } - Err << "Line " << line << " column " << col << " error: " << message; } } // namespace NAST |
