Skip to content

Commit

Permalink
create error on call - fixes #569
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Sep 7, 2023
1 parent 1b0da31 commit a099e98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -145,7 +145,11 @@ hypercores and y-dat listens to changes and applies them to the Yjs document.
</dd>
<dt><a href="https://github.com/liveblocks/liveblocks">@liveblocks/yjs</a></dt>
<dd>
<a href="https://liveblocks.io/document/yjs">Liveblocks Yjs</a> provides a fully hosted WebSocket infrastructure and persisted data store for Yjs documents. No configuration or maintenance is required. It also features Yjs webhook events, REST API to read and update Yjs documents, and a browser DevTools extension.
<a href="https://liveblocks.io/document/yjs">Liveblocks Yjs</a> provides a fully
hosted WebSocket infrastructure and persisted data store for Yjs
documents. No configuration or maintenance is required. It also features
Yjs webhook events, REST API to read and update Yjs documents, and a
browser DevTools extension.
</dd>
<dt><a href="https://github.com/yousefED/matrix-crdt">Matrix-CRDT</a></dt>
<dd>
Expand Down
6 changes: 3 additions & 3 deletions src/types/AbstractType.js
Expand Up @@ -683,7 +683,7 @@ export const typeListInsertGenericsAfter = (transaction, parent, referenceItem,
packJsonContent()
}

const lengthExceeded = error.create('Length exceeded!')
const lengthExceeded = () => error.create('Length exceeded!')

/**
* @param {Transaction} transaction
Expand All @@ -696,7 +696,7 @@ const lengthExceeded = error.create('Length exceeded!')
*/
export const typeListInsertGenerics = (transaction, parent, index, content) => {
if (index > parent._length) {
throw lengthExceeded
throw lengthExceeded()
}
if (index === 0) {
if (parent._searchMarker) {
Expand Down Expand Up @@ -798,7 +798,7 @@ export const typeListDelete = (transaction, parent, index, length) => {
n = n.right
}
if (length > 0) {
throw lengthExceeded
throw lengthExceeded()
}
if (parent._searchMarker) {
updateMarkerChanges(parent._searchMarker, startIndex, -startLength + length /* in case we remove the above exception */)
Expand Down

0 comments on commit a099e98

Please sign in to comment.