From 4db05265eaf6e57e4a51587f13b7955a914d0367 Mon Sep 17 00:00:00 2001 From: Jeffrey Lovitz Date: Sun, 23 Feb 2020 03:00:51 -0500 Subject: [PATCH] Add compile-time error for unsupported AST node types (#944) Co-authored-by: Roi Lipman --- src/ast/ast_build_ar_exp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ast/ast_build_ar_exp.c b/src/ast/ast_build_ar_exp.c index 044bd7074d..8a5cd2896a 100644 --- a/src/ast/ast_build_ar_exp.c +++ b/src/ast/ast_build_ar_exp.c @@ -441,8 +441,11 @@ static AR_ExpNode *_AR_EXP_FromExpression(const cypher_astnode_t *expr) { CYPHER_AST_PATTERN_COMPREHENSION CYPHER_AST_REDUCE */ - printf("Encountered unhandled type '%s'\n", cypher_astnode_typestr(type)); - assert(false); + const char *type_str = cypher_astnode_typestr(type); + char *error; + asprintf(&error, "RedisGraph does not currently support the type '%s'", type_str); + QueryCtx_SetError(error); + return AR_EXP_NewConstOperandNode(SI_NullVal()); } assert(false);