I am writing a library the connect two other componets (Redis and SQLite)
Each of this component in the normal execution may return some error.
Logically the hierarchy of the error looks like this:
Error `|- RedisError `- Foo `|- SQLiteError `- AAA |- BBB |- CCC
Up untill now I only had function that returned an error or from SQLiteError or from RedisError, so I implemented everything as a structure.
Now I am adding features and I start to have functions that may return either error from Redis or error from SQLite
The error from SQLite are quite complex, they are not simple strings.
Ideally I was hoping to have something like a “super class”, Error, as parent of both SQLiteError and RedisError but clearly this is not how Rust works.
There is a clean way to achieve this?