yql_panic.h 704 B

12345678910111213141516171819202122
  1. #pragma once
  2. #include <util/generic/yexception.h>
  3. #include <util/string/builder.h>
  4. #include <util/system/src_root.h>
  5. namespace NYql {
  6. class TYqlPanic : public yexception
  7. {};
  8. namespace NDetail {
  9. [[noreturn]] void YqlPanic(const ::NPrivate::TStaticBuf& file, int line, const char* function, const TStringBuf& condition, const TStringBuf& message);
  10. }
  11. #define YQL_ENSURE(CONDITION, ...) \
  12. do { \
  13. if (Y_UNLIKELY(!(CONDITION))) { \
  14. ::NYql::NDetail::YqlPanic(__SOURCE_FILE_IMPL__, __LINE__, __FUNCTION__, #CONDITION, TStringBuilder() << "" __VA_ARGS__); \
  15. } \
  16. } while (0)
  17. } // namespace NYql