aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/providers/common/gateway/yql_provider_gateway.cpp
blob: ac766a9204933e07a32ba6299af22e95f97b3219 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "yql_provider_gateway.h"

#include <yql/essentials/core/issue/yql_issue.h>
#include <yql/essentials/utils/log/log.h>

namespace NYql {
namespace NCommon {

void TOperationResult::AddIssue(const TIssue& issue) {
    WalkThroughIssues(issue, false, [&](const TIssue& err, ui16 level) {
        Y_UNUSED(level);
        YQL_CLOG(NOTICE, ProviderCommon) << err;
    });
    Issues_.AddIssue(issue);
}

void TOperationResult::AddIssues(const TIssues& issues) {
    for (auto& topIssue: issues) {
        WalkThroughIssues(topIssue, false, [&](const TIssue& err, ui16 level) {
            Y_UNUSED(level);
            YQL_CLOG(NOTICE, ProviderCommon) << err;
        });
    }
    Issues_.AddIssues(issues);
}

void TOperationResult::SetException(const std::exception& e, const TPosition& pos) {
    YQL_CLOG(ERROR, ProviderCommon) << e.what();

    auto issue = ExceptionToIssue(e, pos);
    Status_ = static_cast<NYql::EYqlIssueCode>(issue.GetCode());
    Issues_.AddIssue(issue);
}

void TOperationResult::ReportIssues(TIssueManager& issueManager) const {
    issueManager.RaiseIssues(Issues_);
}

} // NCommon
} // NYql