gklijs / schema_registry_converter

A crate to convert bytes to something more useable and the other way around in a way Compatible with the Confluent Schema Registry. Supporting Avro, Protobuf, Json schema, and both async and blocking.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement std::error::Error for SRCError

MariellHoversholm-Paf opened this issue · comments

Is your feature request related to a problem? Please describe.

The error type does not implement the standard Error trait.

Describe the solution you'd like

Implement std::error::Error, optionally behind a feature-gate.

Describe alternatives you've considered

None.

Additional context

This was discovered while attempting to wrap the error in a snafu enum variant, only to get an error as it does not implement the now fairly old error trait.
To get around this, we opted for a new extension trait to wrap the error with the given type and return SchemaRegistryErr { source: src_error }.fail(), where SchemaRegistryErr is a variant in the snafu declaration with source tagged #[snafu(source(false))].

Thanks, this would indeed make it easier to use, and should be fully backwards compatible. I'll ad it to the 2.1.0 release. I'll probably can start on that in a week.