Closed organizedgrime closed 11 months ago
This is part of the tech debt clean up in Tomb. This shouldn't be done until after [ENG-393](https://linear.app/banyan/issue/ENG-393/convert-tomb-from-a-workspace-repo) has been merged. This will be another round of sweeping changes and the two should exist separately in different PRs.
In general anyhow is only intended to be used by final binaries not by libraries. We have to deal with WNFS using it against its intended purpose but that doesn't mean we should be. If you receive an error from WNFS it should be treated as a `` Box
Description
Removed anyhow from error handling responsibilities, removed entirely from dependencies as well. When it is referenced below, it is actually referring to a
Box<dyn std::error::Error>
. The hole left by the removal of anyhow from this project was vast. In its place, many more nuanced error types needed to be created.ClientError
->ApiError
TombCryptError
for dealing with cryptographic information for the apiurl::ParseError
for dealing with endpointsreqwest::Error
for various network failingsFilesystemError
as described below if the#[cfg(test)]
and#[cfg(feature = "integration-tests")]
conditionals are met. This is because api integration tests rely on performing filesystem operations as a frame of reference, but we dont want this included in the compilation case where it is unneeded.CarError
std::io::Error
UtilityError
for varint functionality inutils
modulecid::error::Error
forCid
parsingBlockStoreError
CarError
for Car based blockstoresanyhow::Error
marked as awnfs
error (wnfs::common::BlockStore
trait still relies onanyhow
)SharingError
for manager / mapper / sharing functionalityTombCryptError
, as many functions requiretomb_crypt
functionalityFilesystemError
forFsMetadata
and related serializationSharingError
for sharingBlockStoreError
, as BlockStore operations required to operate overFsMetadata
and serializeranyhow::Error
internal to it marked as awnfs
error (Additionalwnfs
functionality outside ofBlockStore
such asput_serializable
also relies onanyhow
)NativeError
for CLI and Native library including SyncingTombCryptError
for loading local configuration keysFilesystemError
for operating on aFsMetadata
Filesystem while performing operations such asprepare
andrestore
ApiError
for syncing with remote endpointsstd::io::Error
for on disk file operationsUtilityError
for miscellaneous Utilities and testing that utilizes the testing utilities contained thereinunsigned_varint::decode::Error
for varint decodingstd::io::Error
for various simple file utilitiesstd::string::FromUtf8Error
for parsing representing bytes as strings in thecompute_directory_size
utilityNativeError
if the#[cfg(test)]
and#[cfg(not(target_arch = "wasm32"))]
conditionals are met, as some of these testing utilities also require Native functionality, but those should not be compiled for wasm or when we are not testing.From
impls which minimize the need for using.map_err
directly and maintain code cleanliness throughout the project.Link to issue
https://linear.app/banyan/issue/ENG-401/remove-anyhow
Type of change