LemmyNet / activitypub-federation-rust

High-level Rust library for the Activitypub protocol
GNU Affero General Public License v3.0
431 stars 47 forks source link

Remove `anyhow` dependency #80

Closed cetra3 closed 1 year ago

cetra3 commented 1 year ago

I'm trying to use eyre with this crate and getting some really gnarly generic trait bound errors. It appears it's because functions like receive_activity and the like are coupled to ensuring that something can implement the anyhow::Error type.

I propose we should refactor this out, and rely solely on thiserror for errors within this crate and provide some way of bringing your own errors for library consumers.

Let me know if you're open to this and I can have a crack

Nutomic commented 1 year ago

This seems very tricky because anyhow is used for the library to wrap LemmyError which itself uses anyhow. I have nothing against such a change as long as it works with Lemmy, maybe by putting anyhow behind a feature flag?

cetra3 commented 1 year ago

You might be right, we might be able to coax the error into an anyhow::Error. I'll see how far I get & make sure lemmy compat isn't broken