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 handling in this rust version #3

Closed
songzhi opened this issue Jan 24, 2019 · 5 comments
Closed

Error handling in this rust version #3

songzhi opened this issue Jan 24, 2019 · 5 comments

Comments

@songzhi
Copy link

songzhi commented Jan 24, 2019

There is almost no error/exception-handling code in Python version's Pickledb.It works because Python use try/except and exception to deal with errors and failures.You can always put a try/except block in your code that calling the Pickledb's API.Which will handle the exceptions raised from the internal of the Pickledb.In Rust's version,there is the same situation.But Rust don't use exception,is it a good choice to just panic the thread if something went wrong in internal code.

This question is raised because I saw so many unwrap and expect in Pickledb-rs's code.Would it not be more robust if use error and option?Any plan for this?

@seladb
Copy link
Owner

seladb commented Jan 24, 2019

Thanks for the feedback! I can definitely do that. Do you have specific places where you think error handling is important in particular ?

@songzhi
Copy link
Author

songzhi commented Jan 24, 2019

The dump method I think.In some cases it is called frequently.It's not necessary to panic the whole thread if it failed.

@seladb
Copy link
Owner

seladb commented Jan 24, 2019

That's a good point. Lets me see how I can fix that

seladb added a commit that referenced this issue Feb 1, 2019
@seladb
Copy link
Owner

seladb commented Feb 1, 2019

I added proper error handling. I'll keep this issue open until I release a new version

@seladb
Copy link
Owner

seladb commented Feb 5, 2019

Fixed in version 0.3.0

@seladb seladb closed this as completed Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants