cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Determine which field is causing constrain error response

Mreda
Node Link

Hello,
The case as following,
Considering
Schema:

type User {
id: ID! 
fullName: String!
userName: String! @unique
email: String! @unique
}
Database:
{
id: 1
fullName: private doe
userName: private doe
email: email@test.com
}
When I try to create new user with the same userName, email or both, the error response is not clear about which field is causing the issue and it's something like this:
{
"errors": [
{
"message": "Constraint validation failed",
"locations": [ {
"line": 6,
"column": 3 ],
"path": [
"createUsers"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"stacktrace": [ "Neo4jGraphQLConstraintValidationError: Constraint validation failed" 
],
"data": null
}
FOR INPUT:
{
"input": [
{
"fullName": "private doe ",
"userName": "private doe",
"email": "email@test.com",
}
]
Is there a way to know which field exactly is causing the error to be thrown ?
Any ideas, thoughts to achieve this or even work around would be very appreciated,
Thanks


0 REPLIES 0
Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online