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

Add proper error handling. #3

Open
PopcornPaws opened this issue Jun 2, 2021 · 0 comments
Open

Add proper error handling. #3

PopcornPaws opened this issue Jun 2, 2021 · 0 comments
Labels
enhancement New feature or request epic Large scale enhancement

Comments

@PopcornPaws
Copy link
Member

PopcornPaws commented Jun 2, 2021

Avoid using expect when handling Results since it panics if the result type is an Err. To me it seems that it could easily happen in production that the database fails to insert something and using expect would crash the entire code. Therefore, I would change database handling functions such that they return a Result<Something, response::Error>, so we would be able to handle errors dynamically, e.g. retry calling insert.

Furthermore, try to get rid of unwraps (in tests you can keep them), unless you can guarantee that it will never panic. Maybe add a short comment at every unwrap explaining why is it okay to use it there.

@PopcornPaws PopcornPaws added enhancement New feature or request epic Large scale enhancement labels Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request epic Large scale enhancement
Projects
None yet
Development

No branches or pull requests

1 participant