Yang Xia created TINKERPOP-3289:
-----------------------------------
Summary: Improving error output for chained counters in repeat()
Key: TINKERPOP-3289
URL: https://issues.apache.org/jira/browse/TINKERPOP-3289
Project: TinkerPop
Issue Type: Improvement
Components: process
Affects Versions: 3.8.2, 3.7.7
Reporter: Yang Xia
Combining two loop termination modulators on a single repeat() produces an
error that describes the symptom rather than the issue:
{code:java}
gremlin>
g.V().has('code','AGR').repeat(out()).until(has('code','CCU')).times(3).path().by('code')
The repeat()-traversal was not defined:[TinkerGraphStep(vertex,[code.eq(AGR)]),
RepeatStep([VertexStep(OUT,vertex),
RepeatEndStep],until([HasStep([code.eq(CCU)])]),emit(false)),
RepeatStep(until(loops(3)),null,emit(false)), PathStep([value(code)])]
Type ':help' or ':h' for help.
Display stack trace? [yN] {code}
The message suggests the repeat() body is missing, when the actual problem is
that times(n) is shorthand for until(loops(n)). Both modulators populate the
same slot on RepeatStep, so the second one creates a new, empty RepeatStep that
is never given a body.
The same generic message appears for times().until(), times().times(),
until().until() and the until-first form until(...).times(n).repeat(...).
RepeatUnrollStrategy can also unroll the neighbouring times(n) repeat before
verification runs, removing the context needed to explain the error.
Improve by adding an informative error message that catches all cases.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)