lang_2023/include/error_handling.hpp

25 lines
646 B
C++
Raw Normal View History

#pragma once
2023-04-07 12:13:31 +03:00
#include <iostream>
namespace error_handling {
2023-04-07 12:13:31 +03:00
inline void HandleParsingError(const std::string& message, std::pair<size_t, size_t> place) {
std::cout << "Parsing Error: " << message << " at (" << place.first << ", " << place.second << ").\n";
2023-04-07 12:13:31 +03:00
exit(1);
}
inline void HandleInternalError(const std::string& message, const std::string& place) {
std::cout << "Internal Error: " << message << " at " << place << ".\n";
exit(1);
}
inline void HandleTypecheckError(const std::string& message) { // TODO: place in code
std::cout << "Typecheck Error: " << message << ".\n";
exit(1);
}
// ...
} // namespace error_handling