1 #ifndef __TAN_SRC_BASE_ERROR_H__
2 #define __TAN_SRC_BASE_ERROR_H__
3 #include "base/container.h"
4 #include "source_file/source_file.h"
7 [[noreturn]]
void __tan_assert_fail(
const char *expr,
const char *file,
size_t lineno);
12 #define TAN_ASSERT(expr) (static_cast<bool>((expr)) ? void(0) : __tan_assert_fail(#expr, __FILE__, __LINE__))
14 #define TAN_ASSERT(expr)
18 enum class ErrorType {
39 [[nodiscard]] ErrorType type()
const;
42 ErrorType _type = ErrorType::GENERIC_ERROR;
49 static umap<ErrorType, str> ERROR_TYPE_ENUM_TO_STRING;
52 explicit Error(
const str &error_message);
53 Error(ErrorType type,
const str &error_message);
54 Error(ErrorType type,
Token *start,
Token *end,
const str &error_message);
57 [[noreturn]]
void raise()
const;
58 [[nodiscard]] ErrorType type()
const;
62 ErrorType _type = ErrorType::GENERIC_ERROR;
A span of source code tokens, inclusive on both ends.