banyancomputer / banyan-cli

Banyan's client, BanyanFS+CAR encrypted filesystem packer and metadata handler.
https://banyan.computer/
MIT License
25 stars 2 forks source link

Vera/ENG-401 Remove anyhow #287

Closed organizedgrime closed 11 months ago

organizedgrime commented 11 months ago

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.

Link to issue

https://linear.app/banyan/issue/ENG-401/remove-anyhow

Type of change

linear[bot] commented 11 months ago
ENG-401 Remove anyhow

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 `` not anything related to anyhow. We should switch to using our own narrow Error types based on \`thiserror\` crate as implemented in the cloud services. I'd recommend reading through [this blog post](https://www.lpalmieri.com/posts/error-handling-rust/) that generally lines up with the goal here. The examples that they go through are for a webserver and they do eventually end up on anyhow, but tomb is not that webserver. We want to be able to programmatically handle different types of errors, log and manipulate them in different ways based on the failure mode.