diff --git a/src/query/frontend/ast/cypher_main_visitor.cpp b/src/query/frontend/ast/cypher_main_visitor.cpp index aa617cfce..ab08ac26b 100644 --- a/src/query/frontend/ast/cypher_main_visitor.cpp +++ b/src/query/frontend/ast/cypher_main_visitor.cpp @@ -150,7 +150,7 @@ antlrcpp::Any CypherMainVisitor::visitClause(CypherParser::ClauseContext *ctx) { ctx->createIndex()->accept(this).as()); } // TODO: implement other clauses. - throw utils::NotYetImplemented(); + throw utils::NotYetImplemented("clause '{}'", ctx->getText()); return 0; } @@ -295,7 +295,7 @@ antlrcpp::Any CypherMainVisitor::visitProperties( // better logical plan if we have an information about properties at // compile time. // TODO: implement other clauses. - throw utils::NotYetImplemented(); + throw utils::NotYetImplemented("property parameters"); } return ctx->mapLiteral()->accept(this); } @@ -435,7 +435,7 @@ antlrcpp::Any CypherMainVisitor::visitRelationshipPattern( } if (ctx->relationshipDetail()->rangeLiteral()) { // TODO: implement other clauses. - throw utils::NotYetImplemented(); + throw utils::NotYetImplemented("variable relationship length"); } } // relationship.has_range = true; @@ -623,7 +623,7 @@ antlrcpp::Any CypherMainVisitor::visitExpression5( if (ctx->expression4().size() > 1U) { // TODO: implement power operator. In neo4j power is left associative and // int^int -> float. - throw utils::NotYetImplemented(); + throw utils::NotYetImplemented("power (^) operator"); } return visitChildren(ctx); } @@ -661,7 +661,7 @@ antlrcpp::Any CypherMainVisitor::visitExpression3a( } else if (op->CONTAINS()) { f = NameToFunction(kContains); } else { - throw utils::NotYetImplemented(); + throw utils::NotYetImplemented("function '{}'", op->getText()); } auto expression2 = op->expression3b()->accept(this); std::vector args = {expression, expression2}; @@ -739,7 +739,7 @@ antlrcpp::Any CypherMainVisitor::visitAtom(CypherParser::AtomContext *ctx) { ctx->literal()->accept(this).as()); } else if (ctx->parameter()) { // TODO: implement other clauses. - throw utils::NotYetImplemented(); + throw utils::NotYetImplemented("atom parameters"); } else if (ctx->parenthesizedExpression()) { return static_cast( ctx->parenthesizedExpression()->accept(this)); @@ -758,7 +758,7 @@ antlrcpp::Any CypherMainVisitor::visitAtom(CypherParser::AtomContext *ctx) { } // TODO: Implement this. We don't support comprehensions, filtering... at // the moment. - throw utils::NotYetImplemented(); + throw utils::NotYetImplemented("atom expression '{}'", ctx->getText()); } antlrcpp::Any CypherMainVisitor::visitLiteral( @@ -782,7 +782,7 @@ antlrcpp::Any CypherMainVisitor::visitLiteral( ctx->listLiteral()->accept(this).as>())); } else { // TODO: Implement map literal. - throw utils::NotYetImplemented(); + throw utils::NotYetImplemented("map literal"); } return visitChildren(ctx); } @@ -809,7 +809,7 @@ antlrcpp::Any CypherMainVisitor::visitNumberLiteral( antlrcpp::Any CypherMainVisitor::visitFunctionInvocation( CypherParser::FunctionInvocationContext *ctx) { if (ctx->DISTINCT()) { - throw utils::NotYetImplemented(); + throw utils::NotYetImplemented("DISTINCT function call"); } std::string function_name = ctx->functionName()->accept(this); std::vector expressions; diff --git a/src/query/frontend/ast/cypher_main_visitor.hpp b/src/query/frontend/ast/cypher_main_visitor.hpp index 52afde5b0..6c45818be 100644 --- a/src/query/frontend/ast/cypher_main_visitor.hpp +++ b/src/query/frontend/ast/cypher_main_visitor.hpp @@ -55,7 +55,7 @@ class CypherMainVisitor : public antlropencypher::CypherBaseVisitor { case kGeTokenId: return storage_.Create(e1, e2); default: - throw utils::NotYetImplemented(); + throw utils::NotYetImplemented("binary operator"); } } @@ -68,7 +68,7 @@ class CypherMainVisitor : public antlropencypher::CypherBaseVisitor { case kUnaryMinusTokenId: return storage_.Create(e); default: - throw utils::NotYetImplemented(); + throw utils::NotYetImplemented("unary operator"); } } diff --git a/src/query/interpret/eval.hpp b/src/query/interpret/eval.hpp index a5afe2283..b462711e0 100644 --- a/src/query/interpret/eval.hpp +++ b/src/query/interpret/eval.hpp @@ -250,8 +250,7 @@ class ExpressionEvaluator : public TreeVisitor { property_lookup.property_); case TypedValue::Type::Map: // TODO implement me - throw utils::NotYetImplemented( - "Not yet implemented property lookup on map"); + throw utils::NotYetImplemented("property lookup on map"); default: throw QueryRuntimeException( "Expected Node, Edge or Map for property lookup"); diff --git a/src/query/plan/operator.cpp b/src/query/plan/operator.cpp index b3340a602..ed7676a4b 100644 --- a/src/query/plan/operator.cpp +++ b/src/query/plan/operator.cpp @@ -986,7 +986,7 @@ void ReconstructTypedValue(TypedValue &value) { break; case TypedValue::Type::Path: // TODO implement path reconstruct? - throw utils::NotYetImplemented("Path reconstruction not yet supported"); + throw utils::NotYetImplemented("path reconstruction"); default: break; } diff --git a/src/query/plan/rule_based_planner.cpp b/src/query/plan/rule_based_planner.cpp index def5acc5c..f79f82e8c 100644 --- a/src/query/plan/rule_based_planner.cpp +++ b/src/query/plan/rule_based_planner.cpp @@ -1109,8 +1109,7 @@ std::unique_ptr RuleBasedPlanner::Plan( input_op = new plan::CreateIndex(create_index->label_, create_index->property_); } else { - throw utils::NotYetImplemented( - "Encountered a clause which cannot be converted to operator(s)"); + throw utils::NotYetImplemented("clause conversion to operator(s)"); } } } diff --git a/src/query/typed_value.cpp b/src/query/typed_value.cpp index 79e2c4149..597514e24 100644 --- a/src/query/typed_value.cpp +++ b/src/query/typed_value.cpp @@ -505,7 +505,7 @@ TypedValue operator==(const TypedValue &a, const TypedValue &b) { return true; } case TypedValue::Type::Path: - throw utils::NotYetImplemented(); + throw utils::NotYetImplemented("equality for TypedValue::Type::Path"); default: permanent_fail("Unhandled comparison for types"); } @@ -780,7 +780,7 @@ size_t TypedValue::Hash::operator()(const TypedValue &value) const { case TypedValue::Type::Edge: return value.Value().temporary_id(); case TypedValue::Type::Path: - throw utils::NotYetImplemented(); + throw utils::NotYetImplemented("hashing for TypedValue::Type::Path"); break; } permanent_fail("Unhandled TypedValue.type() in hash function"); diff --git a/src/utils/exceptions.hpp b/src/utils/exceptions.hpp index 4997f0799..7821d0def 100644 --- a/src/utils/exceptions.hpp +++ b/src/utils/exceptions.hpp @@ -182,14 +182,15 @@ class StacktraceException : public std::exception { /** * @brief Raise this exception for functionality which is yet to be implemented. */ -class NotYetImplemented final : public StacktraceException { +class NotYetImplemented final : public BasicException { public: - using StacktraceException::StacktraceException; + explicit NotYetImplemented(const std::string &what) noexcept + : BasicException("Not yet implemented: " + what) {} - /** - * @brief Construct with the default "Not yet implemented!" message. - */ - NotYetImplemented() noexcept : StacktraceException("Not yet implemented!") {} + template + explicit NotYetImplemented(const std::string &format, + Args &&... args) noexcept + : NotYetImplemented(fmt::format(format, std::forward(args)...)) {} }; } // namespace utils