Calling discard() after mutations throws the error: "Transaction has been aborted, please retry." (Code 10) #48
Labels
area/usability
Issues with usability and error messages
kind/bug
Something is broken.
status/accepted
We were able to reproduce the issue and accept to work on it.
Hello!
I think the client has a strange behavior when we call
discard()
after some mutations: it throws the following error :Transaction has been aborted. Please retry
. I don't think it is useful, because if I call this method, it's precisely because I want to abort the transaction (and didn't callcommit()
)...In this case, I noticed that the error object has an additionnal property
code
with the value10
, and the following is false:e == dgraph.ERR_ABORTED
.Although the error message is the same, the error thrown when a conflict occurs during a transaction doesn't have this property
code
, and we can assert that:e == dgraph.ERR_ABORTED
.In my project, I currently monkey-patch the library the following way...
It is annoying because, usually, the call to
discard()
occurs in afinally
block, so the error is not handled properly.What do you think about this issue? Is this a desired behavior?
Thanks in advance for your answers. :)
The text was updated successfully, but these errors were encountered: