Actually after looking at the code, it appears that the only time the consumer errors are actually discarded was when iterating over the links from a webfinger query. Since multiple links need to be tried there are multiple errors and it doesn't make much sense to return all of them.
Instead log the error so that it can be observed by the consumer of the library.
To resume:
This PR improves the webfinger error by:
Making it its own enum and adding granularity
Logging the failure when dereferencing the links from the webfinger query. This is done by adding a Display bound on the error type. I didn't add the full std::error::Error because it conflicts with some of the examples, and implementing Error is incompatible with impl<T: Into<anyhow::Error>> Error for ….
Improving the webfinger parsing and getting rid of the regex (not fully rid of the crate since it is used in 1 more place).
The new version is equivalent to the old, tested by fuzzing.
Given that the inital issue is fixed just by adding a log line, it might make sense to drop this PR and make on that just adds the Display bound and the log line for simplicity.
Fix #83
Actually after looking at the code, it appears that the only time the consumer errors are actually discarded was when iterating over the links from a webfinger query. Since multiple links need to be tried there are multiple errors and it doesn't make much sense to return all of them.
Instead log the error so that it can be observed by the consumer of the library.
To resume:
This PR improves the webfinger error by:
Display
bound on the error type. I didn't add the fullstd::error::Error
because it conflicts with some of the examples, and implementingError
is incompatible withimpl<T: Into<anyhow::Error>> Error for …
.Given that the inital issue is fixed just by adding a log line, it might make sense to drop this PR and make on that just adds the
Display
bound and the log line for simplicity.