pchampin / sophia_rs

Sophia: a Rust toolkit for RDF and Linked Data
Other
210 stars 23 forks source link

Relax inner error trait bounds for `StreamError` #135

Closed damooo closed 1 year ago

damooo commented 1 year ago

Currently StreamError's variants SourceErr, SinkErr expects inner value to implement std::error::Error. Many errors may not implement that trait like anyhow::Error. There seems no requirement for that bound.

pchampin commented 1 year ago

There is an implicit requirement: StreamError itself implements std::error::Error, and relies on its inner error to do so. Removing this would have an impact on other types...

For me, it seems natural that error types should implement std::error::Error. The reason for anyhow::Error to not implement this trait looks more like a technical constraint than a conceptual choice. And a workaround is proposed.