You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Avoid using
expect
when handlingResult
s since it panics if the result type is anErr
. To me it seems that it could easily happen in production that the database fails to insert something and usingexpect
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 callinginsert
.Furthermore, try to get rid of
unwrap
s (in tests you can keep them), unless you can guarantee that it will never panic. Maybe add a short comment at everyunwrap
explaining why is it okay to use it there.The text was updated successfully, but these errors were encountered: