elastic / elasticsearch-rs

Official Elasticsearch Rust Client
https://www.elastic.co/guide/en/elasticsearch/client/rust-api/current/index.html
Apache License 2.0
702 stars 72 forks source link

Make the top-level error type opaque #41

Closed KodrAus closed 4 years ago

KodrAus commented 4 years ago

Hi! :wave:

I'm spending some time poking around and thought I'd submit a few PRs for bits and pieces.

This PR refactors the top-level Error enum so that it's an opaque struct instead of an open enum. This means changes can be made to the internals of the error without breaking callers relying on the enum having a particular shape. As an example of a change, one day we might want to replace the Lib(String) variant with something strongly typed. It also means a Backtrace could be introduced, because it'll have a natural place to live within the struct.

russcam commented 4 years ago

Thanks for the PR, @KodrAus 👍