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

use errors instead of panic #415

Open
zignis opened this issue Apr 10, 2024 · 3 comments
Open

use errors instead of panic #415

zignis opened this issue Apr 10, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@zignis
Copy link
Contributor

zignis commented Apr 10, 2024

There are numerous instances of panic in the codebase, which are not ideal for production use cases. This often results in crashes of the processes on our production machines because we accept dynamic documents from users, which might contain malformed data. I believe that returning errors instead of panicking would be a better approach.

For instance, the following line has been causing panics in our production instance:

panic!("Couldn't get item's parent")

We cannot always verify whether the incoming data from the client is correct.

I'm ready to work on this if you give me some hints about your preferred approach.

@Horusiath
Copy link
Collaborator

Horusiath commented Apr 10, 2024

@zignis we're at the process of removing panics. However the ones that usually remained points to potentially bugs or configuration issues. The fact that you've run into this error most likely points to one of these issues. Do you have any reproducible scenario that could help us fix it?

@zignis
Copy link
Contributor Author

zignis commented Apr 11, 2024

@Horusiath This happened randomly with one of our users, and I cannot provide their document due to obvious reasons. I am trying to reproduce it from a new document, and I'll get back to you if I succeed.

@appflowy
Copy link
Contributor

@Horusiath I have the same issues but I don't how to reproduce them. It happened when i try to call
txn.encode_state_as_update_v1(&StateVector::default())

@Horusiath Horusiath self-assigned this Apr 18, 2024
@Horusiath Horusiath added the bug Something isn't working label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants