Skip to content
Discussion options

You must be logged in to vote

I was about to answer you in self-confidence that the server would reject the transaction along with all other operations in it, forcing the client to rollback its transaction.

The correct behavior is that the server will throw a ConstraintError and revert all accompanied changes in the same transaction:

  1. Client adds new object locally (not yet aware of that it's primary key will collide once it reaches the server)
  2. Client syncs its transaction(s) (POST /sync)
  3. The server throws ConstraintError and refuses to apply any of the operations in the same transaction.
  4. Server responds HTTP 200 ok with:
    {
      "rejections": [
        {
          "name": "ConstraintError",
          "message": "Key already exists: …

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by dfahlander
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants