Closed sgued closed 11 months ago
I dont think a separate error type is the way to go. Better to change the enum variant WebfingerResolveFailed
to WebfingerResolveFailed(anyhow::Error)
and then replace this line with .map_err(Error::WebfingerResolveFailed)
. PR welcome :)
This would solve the issue with regards to the web finger request but not for every other types of error.
I only mentioned WebFingerRequest because it is one of the first things I implemented and therefore encountered the issue but I'd be surprised if the other errors never end up "eating" the Object
errors either.
Maybe another less "breaking" option would be to always log the errors that don't come from the library itself.
PR welcome
Of course I will do so once we have agreed on a satisfying solution.
You can do the same thing for other error types where this makes sense. But for example RequestLimit doesnt have any associated source error, so in that case it doesnt make sense.
Since https://github.com/LemmyNet/activitypub-federation-rust/pull/82 has been merged should I go for Box<dyn Error>
rather than anyhow::Error
?
Yes thats right, or even a more specific error if possible such as reqwest::Error
.
Hi,
When trying to implement some basic activitypub functionality, I found it very hard to know where the errors came from. For example, when implementing a basic actor and using
webfinger_resolve_actor
, I just get aWebFingerResolveFailed
error, while my code generated more error information than that.I suggest replacing the current
Error
value with:And implement the
Error
trait on top of the structError
. That way usingstd::Error::source
the full error information can be found.