Skip to content

Commit 9070652

Browse files
committed
Improve cypher error messages
1 parent 06a13f0 commit 9070652

6 files changed

Lines changed: 7 additions & 10 deletions

File tree

core/src/main/java/org/polypheny/db/algebra/enumerable/RexToLixTranslator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ private Expression translateCall( RexCall call, RexImpTable.NullAs nullAs ) {
522522
final Operator operator = call.getOperator();
523523
CallImplementor implementor = RexImpTable.INSTANCE.get( operator );
524524
if ( implementor == null ) {
525-
throw new GenericRuntimeException( "cannot translate call " + call );
525+
throw new GenericRuntimeException( "Cannot translate call " + call );
526526
}
527527
return implementor.implement( this, call, nullAs );
528528
}

plugins/cypher-language/src/main/java/org/polypheny/db/cypher/cypher2alg/CypherToAlgConverter.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,13 @@ private void convertQuery( CypherNode node, CypherContext context ) {
159159
switch ( node.getCypherKind() ) {
160160
case SINGLE:
161161
CypherSingleQuery query = (CypherSingleQuery) node;
162-
163162
for ( CypherClause clause : query.getClauses() ) {
164163
convertClauses( clause, context );
165164
}
166-
167165
break;
168166
case PERIODIC_COMMIT:
169167
case UNION:
170-
throw new UnsupportedOperationException();
168+
throw new UnsupportedOperationException( "Unsupported cypher operation: " + node.getCypherKind() );
171169
}
172170
}
173171

@@ -201,9 +199,8 @@ private void convertClauses( CypherClause clause, CypherContext context ) {
201199
convertRemove( (CypherRemove) clause, context );
202200
break;
203201
default:
204-
throw new UnsupportedOperationException();
202+
throw new UnsupportedOperationException( "Unsupported cypher clause: " + clause.getCypherKind() );
205203
}
206-
207204
}
208205

209206

plugins/cypher-language/src/main/java/org/polypheny/db/cypher/expression/CypherExpression.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public Pair<PolyString, RexNode> getRex( CypherContext context, RexType type ) {
8383
case ANY -> OperatorName.CYPHER_ANY_MATCH;
8484
case NONE -> OperatorName.CYPHER_NONE_MATCH;
8585
case SINGLE -> OperatorName.CYPHER_SINGLE_MATCH;
86-
default -> throw new UnsupportedOperationException();
86+
default -> throw new UnsupportedOperationException( "Unsupported cypher expression: " + this.type );
8787
};
8888

8989
// ANY ( Variable IN Expression(list) Where? )

plugins/cypher-language/src/main/java/org/polypheny/db/cypher/expression/CypherFunctionInvocation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public CypherFunctionInvocation( ParserPos beforePos, ParserPos namePos, List<St
4343
if ( operatorNames.contains( image.toUpperCase( Locale.ROOT ) ) ) {
4444
this.op = OperatorName.valueOf( image.toUpperCase( Locale.ROOT ) );
4545
} else {
46-
throw new GenericRuntimeException( "Used function is not supported!" );
46+
throw new GenericRuntimeException( "Unsupported cypher function: " + image.toUpperCase( Locale.ROOT ) );
4747
}
4848
this.distinct = distinct;
4949
this.arguments = arguments;

plugins/cypher-language/src/main/java/org/polypheny/db/cypher/expression/CypherGate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public Pair<PolyString, RexNode> getRex( CypherContext context, RexType type ) {
6363
operatorName = OperatorName.AND;
6464
break;
6565
case XOR:
66-
throw new UnsupportedOperationException();
66+
throw new UnsupportedOperationException( "Unsupported cypher operator: " + gate );
6767
case NOT:
6868
return handleSingular( context, type, OperatorName.NOT );
6969
}

plugins/cypher-language/src/main/java/org/polypheny/db/cypher/expression/CypherVariable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public Pair<PolyString, RexNode> getRex( CypherContext context, RexType type ) {
8181
}
8282
}
8383

84-
throw new GenericRuntimeException( "The used variable is not known." );
84+
throw new GenericRuntimeException( "Unknown variable: " + name );
8585
}
8686

8787

0 commit comments

Comments
 (0)