-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed as not planned
Labels
Stalearea/upsertIssues related to upsert operations.Issues related to upsert operations.area/usabilityIssues with usability and error messagesIssues with usability and error messagesdgraphIssue or PR created by an internal Dgraph contributor.Issue or PR created by an internal Dgraph contributor.kind/enhancementSomething could be better.Something could be better.status/acceptedWe accept to investigate/work on it.We accept to investigate/work on it.
Description
Experience Report
This could be useful to create error UI instead of a JSON response.
What you wanted to do
An upsert mutation.
The error model we currently have can be bad to read when making big queries. There are users (mainly customers) who make huge queries with many variables. The error message can get big and confusing. In addition to containing characters that hinder reading.
What you actually did
A wrong upsert block
upsert {
query {
me(func: eq(email, "user@company1.io")) {
u as uid
n as name
a as age
e as email
}
}
mutation @if(eq(n, "Animesh")) {
set {
_:newNode <name> val(name) .
_:newNode <age> val(age) .
_:newNode <email> val(email) .
}
}
}
Why that wasn't great, with examples
This error is bad for some cases.
{
"name": "t",
"url": "http://localhost:8080/mutate?commitNow=true",
"errors": [
{
"message": "Some variables are defined but not used\nDefined:[__dgraph__0 a e n u]\nUsed:[__dgraph__0 age email name]\n",
"extensions": {
"code": "ErrorInvalidRequest"
}
}
]
}
The answer should be something like
{
"name": "t",
"url": "http://localhost:8080/mutate?commitNow=true",
"errors": [
{
"message": "Some variables are defined but not used",
"Defined": "a e n u",
"Used": "age email name",
"extensions": {
"code": "ErrorInvalidRequest"
}
}
]
}
Or something similar to
{
"name": "t",
"url": "http://localhost:8080/mutate?commitNow=true",
"errors": [
{
"message": "Some variables are defined but not use",
"Details": {
"Defined": "a e n u",
"Used": "age email name"
},
"extensions": {
"code": "ErrorInvalidRequest"
}
}
]
}
Metadata
Metadata
Assignees
Labels
Stalearea/upsertIssues related to upsert operations.Issues related to upsert operations.area/usabilityIssues with usability and error messagesIssues with usability and error messagesdgraphIssue or PR created by an internal Dgraph contributor.Issue or PR created by an internal Dgraph contributor.kind/enhancementSomething could be better.Something could be better.status/acceptedWe accept to investigate/work on it.We accept to investigate/work on it.