0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-25 11:17:50 +01:00
posthog/hogql_parser/error.cpp
Michael Matloka 8f62e85c9d
chore(hogql): Full error & NULL handling in C++ parser (1.0.0) (#18240)
* chore(hogql): Be defensive against NULLs in the C++ parser

* Clean up on C++ exceptions

* Add to CONTRIBUTING guide

* Revert `AllowShortFunctionsOnASingleLine` change

* Update HogQLX additions too

* Bump version to 1.0.0

* Use new hogql-parser version

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-27 13:37:15 +02:00

18 lines
867 B
C++

#include "error.h"
using namespace std;
#define EXCEPTION_CLASS_IMPLEMENTATION(NAME, BASE) \
NAME::NAME(const string& message, size_t start, size_t end) : BASE(message), start(start), end(end) {} \
NAME::NAME(const char* message, size_t start, size_t end) : BASE(message), start(start), end(end) {} \
NAME::NAME(const string& message) : BASE(message), start(0), end(0) {} \
NAME::NAME(const char* message) : BASE(message), start(0), end(0) {}
EXCEPTION_CLASS_IMPLEMENTATION(HogQLException, runtime_error)
EXCEPTION_CLASS_IMPLEMENTATION(SyntaxException, HogQLException)
EXCEPTION_CLASS_IMPLEMENTATION(NotImplementedException, HogQLException)
EXCEPTION_CLASS_IMPLEMENTATION(ParsingException, HogQLException)
PyInternalException::PyInternalException() : exception() {}