aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/utils/yql_panic.h
blob: e7e559b2c50f8ce5f0a38b9cbd05b55b94f77191 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once
#include <util/generic/yexception.h>
#include <util/string/builder.h>
#include <util/system/src_root.h>

namespace NYql {

class TYqlPanic : public yexception
{};

namespace NDetail {
    [[noreturn]] void YqlPanic(const ::NPrivate::TStaticBuf& file, int line, const char* function, const TStringBuf& condition, const TStringBuf& message);
}

#define YQL_ENSURE(CONDITION, ...)     \
    do {                                   \
        if (Y_UNLIKELY(!(CONDITION))) {    \
            ::NYql::NDetail::YqlPanic(__SOURCE_FILE_IMPL__, __LINE__, __FUNCTION__, #CONDITION, TStringBuilder() << "" __VA_ARGS__); \
        }                                  \
    } while (0)

} // namespace NYql