Error handling in this rust version
songzhi opened this issue · 5 comments
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?
Thanks for the feedback! I can definitely do that. Do you have specific places where you think error handling is important in particular ?
The dump
method I think.In some cases it is called frequently.It's not necessary to panic the whole thread if it failed.
That's a good point. Lets me see how I can fix that
I added proper error handling. I'll keep this issue open until I release a new version