n24q02m opened a new pull request, #3241:
URL: https://github.com/apache/hugegraph/pull/3241
## Purpose of the PR
Machine-readable error metadata for the Cypher API: stable error codes plus
per-error hint strings, so clients can branch on failure modes instead of
parsing message text.
Complements #238 (bound-query support, currently in hugegraph/hugegraph):
that change adds validated parameter bindings; this change makes Cypher
failures carry a structured `errors` array. The two are independent — this
branch applies cleanly on master (`ed8344d19`, single commit, `Signed-off-by`
present).
## Main Changes
- NEW `CypherErrorMapper` (+67): maps Cypher op-processor failure classes to
stable error codes and per-class hint strings.
- `CypherModel` (+27): `errors[].code / message / hint` payload fields.
- `CypherClient` (+3 −2): surfaces mapped errors to the client.
- `CypherApiTest` (+18): structured-error assertions — syntax failure
returns `"errors"` with `SyntaxError` and a "Declare the variable" hint;
undefined schema element returns `ExecutionError` with a "Create the schema
element" hint.
## Verifying these changes
- [ ] Trivial rework / code cleanup without any test coverage. (No Need)
- [ ] Already covered by existing tests.
- [x] Need tests and can be verified as follows:
- Java 17; `mvn -DskipTests test-compile` on this exact branch: clean.
- Same mapper code on the author's fork branch: `CypherApiTest` 10/10
incl. error-code assertions, plus live REST verification 2026-09-26 — syntax
error → `errors:[{"code":"HugeGraph.Cypher.ExecutionError","message":"Invalid
input …","hint":""}]`, valid query → 200 with `errors:[]`.
## Does this PR potentially affect the following parts?
- [ ] Dependencies
- [ ] Modify configurations
- [x] The public API (error response shape for `/cypher`)
- [ ] Other affects
- [ ] Nope
## Documentation Status
- [x] `Doc - TODO`: the error-code → hint table will be documented in the
paired website PR (apache/hugegraph-doc#499 or a follow-up) once the code set
is agreed here.
- [ ] `Doc - Done`
- [ ] `Doc - No Need`
## Notes
- ICLA submitted 2026-09-26 (same contributor as apache/hugegraph-doc#499).
- When #238's line lands upstream, this PR expects a bounded rebase: overlap
is limited to `CypherClient.java` (this PR: 3 lines) among the files #238
reworks.
- Reference implementation with parameter binding + error metadata combined
(not proposed here) stays available on the fork:
`n24q02m/hugegraph@cypher-error-metadata`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]