8000 Better Integration Error Messages by Waidhoferj · Pull Request #46 · y-crdt/ypy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Better Integration Error Messages #46

Closed
wants to merge 2 commits into from

Conversation

Waidhoferj
Copy link
Collaborator
@Waidhoferj Waidhoferj commented Apr 28, 2022

Fixes #44

Added more expressive error messages to the Prelim trait implementations

  • Will raise a native Python error instead of throwing a panic

Example

d = Y.YDoc()
m = d.get_map("test")
d2 = Y.YDoc()
with d.begin_transaction() as txn:
        m.set(txn, "blah", 1)

container = d2.get_map("container")

with d2.begin_transaction() as txn:
        container.set(txn, "thisBreaks", m) # error happens here because `m` is already part of `d`

This results in the following error message:

y_py.MultipleIntegrationError: Cannot integrate data that is already a part of another YDoc: {'blah': 1.0}

@Waidhoferj Waidhoferj added the enhancement New feature or request label Apr 28, 2022
@Waidhoferj Waidhoferj self-assigned this Apr 28, 2022
@Waidhoferj Waidhoferj marked this pull request as ready for review April 28, 2022 21:45
@Waidhoferj Waidhoferj requested a review from dmonad April 28, 2022 21:45
@Waidhoferj
Copy link
Collaborator Author

Closed in favor of #49

@Waidhoferj Waidhoferj closed this May 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Throw more expressive error when already integrated type is inserted
2 participants
0