rustic_core icon indicating copy to clipboard operation
rustic_core copied to clipboard

refactor(error)!: handle errors more gracefully in rustic_core.

Open simonsan opened this issue 1 year ago • 3 comments

Till now, rustic_core had a lot of unwraps and expects sprinkled over the code base. This made rustic_core and dependents panic in case of errors. This is unacceptable for a library, hence we fixed it now.

Fixes #140

TODO:

  • [X] Implement unit tests for test coverage of some changes
  • [x] Fix integration test
  • [x] 0 (*nix) errors left (due to unwrap/expect being denied)

Possible Panics left over/reintroduced:

simonsan avatar Mar 13 '24 10:03 simonsan

Codecov Report

Attention: Patch coverage is 26.00000% with 444 lines in your changes missing coverage. Please review.

Project coverage is 27.5%. Comparing base (fb291dc) to head (f1218c8). Report is 106 commits behind head on main.

Files with missing lines Patch % Lines
crates/core/src/commands/restore.rs 0.0% 123 Missing :warning:
crates/core/src/blob/packer.rs 54.4% 61 Missing :warning:
crates/core/src/commands/prune.rs 4.3% 44 Missing :warning:
crates/core/src/vfs.rs 0.0% 29 Missing :warning:
crates/core/src/backend/local_destination.rs 15.1% 28 Missing :warning:
crates/core/src/backend/cache.rs 0.0% 24 Missing :warning:
crates/core/src/blob/tree.rs 32.1% 19 Missing :warning:
crates/core/src/commands/copy.rs 0.0% 17 Missing :warning:
crates/core/src/commands/forget.rs 0.0% 15 Missing :warning:
crates/core/src/archiver.rs 45.8% 13 Missing :warning:
... and 21 more
Additional details and impacted files
Files with missing lines Coverage Δ
crates/backend/src/choose.rs 0.0% <ø> (ø)
crates/backend/src/opendal.rs 0.0% <ø> (ø)
crates/backend/src/rclone.rs 87.5% <ø> (+9.7%) :arrow_up:
crates/core/src/archiver/file_archiver.rs 77.0% <ø> (ø)
crates/core/src/cdc/polynom.rs 75.0% <ø> (ø)
crates/core/src/cdc/rolling_hash.rs 54.3% <ø> (ø)
crates/core/src/chunker.rs 58.6% <ø> (+0.7%) :arrow_up:
crates/core/src/crypto/aespoly1305.rs 77.7% <ø> (-5.6%) :arrow_down:
crates/core/src/error.rs 25.0% <ø> (+10.7%) :arrow_up:
crates/core/src/index/binarysorted.rs 54.5% <ø> (-0.9%) :arrow_down:
... and 36 more

... and 7 files with indirect coverage changes

codecov[bot] avatar Mar 13 '24 11:03 codecov[bot]

The CI fails for Test Coverage, I don't intend to write tests at this stage for the changes as I think we should focus on the other tests first, that we wanted to implement (e.g. path related stuff).

I don't want to implement these tests in this PR though, as it's already quite big.

simonsan avatar Mar 15 '24 02:03 simonsan

OK, added some more testing, so the coverage test also runs through. 👍🏽

simonsan avatar Mar 15 '24 13:03 simonsan

Closing this as it's heavily outdated.

simonsan avatar Oct 07 '24 03:10 simonsan