Skip to content

Add proper error handling. #3

@PopcornPaws

Description

@PopcornPaws

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestepicLarge scale enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions