blob: 8077f23c2f0d399e65690936d12ca69dfba551f7 (
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
41
42
43
44
45
46
47
48
49
50
51
|
#pragma once
#include <yql/essentials/core/issue/protos/issue_id.pb.h>
#include <yql/essentials/public/issue/yql_issue.h>
#include <yql/essentials/public/issue/yql_issue_id.h>
#ifdef _win_
#ifdef GetMessage
#undef GetMessage
#endif
#endif
namespace NYql {
extern const char IssueMapResource[14];
using EYqlIssueCode = TIssuesIds::EIssueCode;
inline ESeverity GetSeverity(EYqlIssueCode id) {
return GetSeverity<TIssuesIds, IssueMapResource>(id);
}
inline TString GetMessage(EYqlIssueCode id) {
return GetMessage<TIssuesIds, IssueMapResource>(id);
}
inline TIssue& SetIssueCode(EYqlIssueCode id, TIssue& issue) {
issue.SetCode(id, GetSeverity(id));
return issue;
}
inline TString IssueCodeToString(EYqlIssueCode id) {
const TString& message = GetMessage(id);
if (message) {
return message;
} else {
return IssueCodeToString<TIssuesIds>(id);
}
}
inline TIssue YqlIssue(const TPosition& position, EYqlIssueCode id, const TString& message) {
TIssue issue(position, message);
SetIssueCode(id, issue);
return issue;
}
inline TIssue YqlIssue(const TPosition& position, EYqlIssueCode id) {
return YqlIssue(position, id, IssueCodeToString(id));
}
}
|