Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error("Length exceeded!") should not be a module variable #569

Closed
dev-guy opened this issue Sep 5, 2023 — with Huly GitHub · 1 comment
Closed

Error("Length exceeded!") should not be a module variable #569

dev-guy opened this issue Sep 5, 2023 — with Huly GitHub · 1 comment
Assignees

Comments

Copy link

dev-guy commented Sep 5, 2023

Checklist

[x] Are you reporting a bug? Use github issues for bug reports and feature requests. For general questions, please use https://discuss.yjs.dev/ [x] Try to report your issue in the correct repository. Yjs consists of many modules. When in doubt, report it to https://github.com/yjs/yjs/issues/

Is your feature request related to a problem? Please describe. The error "Length exceeded!" is thrown in a couple places[1]. Because the Error object is a module variable, its stack doesn't reflect where the exception was actually thrown. Therefore, it's impossible to know for sure what the error is (which method was called).

[1] src/types/AbstractType.js line 686 const lengthExceeded = error.create('Length exceeded!')

Describe the solution you'd like

const lengthExceeded = "Length exceeded!"
...
throw new Error(lengthExceeded);

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

Version 13.6.7

The error occurs when using splice() to insert an element into an array. I'm using SvelteSyncedStore so I don't exactly know how YJs is being used. I'm sure YArray is involved.

I guess it would be nice if the error message contained the provided index that is out of bounds. I'm trying to get that logged somehow.

Huly®: YJS-381

@dev-guy dev-guy changed the title Do not hard-code Error("Length exceeded!") Error("Length exceeded!") should not be a module variable Sep 5, 2023
@dmonad dmonad closed this as completed in a099e98 Sep 7, 2023
@dmonad
Copy link
Member

dmonad commented Sep 7, 2023

Right, thanks. I fixed the issue. This will be added to the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants