blob: 6aa5da928ed134257554eaf1eca63fd4a7aa2e4c (
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
52
|
#pragma once
#include <util/string/cast.h>
namespace NKikimr {
namespace NMiniKQL {
struct TValidateErrorPolicyNone {
};
struct TUdfValidateException: public yexception {
};
struct TValidateErrorPolicyThrow {
static void Generate(const TString& message) {
GenerateExc(TUdfValidateException() << message);
}
template<class TException>
static void GenerateExc(const TException& exc) {
static_assert(std::is_base_of<yexception, TException>::value, "Must be derived from yexception");
ythrow TException() << exc.AsStrBuf();
}
};
struct TValidateErrorPolicyFail {
static void Generate(const TString& message) {
Y_ABORT("value verify failed: %s", message.c_str());
}
template<class TException>
static void GenerateExc(const TException& exc) {
Generate(ToString(exc.AsStrBuf()));
}
};
template<class TValidateMode>
struct TValidate<TValidateErrorPolicyNone, TValidateMode> {
static NUdf::TUnboxedValue Value(const NUdf::IValueBuilder* valueBuilder, const TType* type, NUdf::TUnboxedValue&& value, const TString& message, bool* wrapped) {
Y_UNUSED(valueBuilder);
Y_UNUSED(type);
Y_UNUSED(message);
Y_UNUSED(wrapped);
return std::move(value);
}
static void WrapCallable(const TCallableType*, NUdf::TUnboxedValue&, const TString&) {}
};
} // namespace MiniKQL
} // namespace NKikimr
|