mclang / kiho-wt-puncher

Rust CLI app to make Kiho worktime login/logout punches using Kiho API
GNU General Public License v3.0
1 stars 0 forks source link

Improve error handling #5

Open mclang opened 2 months ago

mclang commented 2 months ago

Problem

Error handling is mix of everything found from the examples.

Solution

  1. Check that plain unwrap() is not used haphazardly - use except instead.
  2. Improve panic! usage where necessary.
  3. Get rid of unnecessary panics by using ok_or_else, map_err and possibly with anyhow crate.
  4. Improve error handling: Practical Guide to Error Handling
  5. Check also You're probably misusing unwrap in Rust...