You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we rely on snafu to define/handle errors, there are some issues with current usage.
First, let me explain how error is defined within horaedb.
Every module has an an Enum-style error, which contains detailed error information
When convert error from one module to another, we use context to do the heavy work.
This sounds like a good design pattern, but it become very verbose in practice. Some example:
Every module force an Enum-style error, which contains too many unnecessary item.
When consume error from module A in module B, we usually box them, since we don't want to define too many error item in module B. This make the error opaque again...
All in all, enum based error design should be limited in some way.
Proposal
Error details should be opaque, if caller want to program based on it, the error provide a pub fn kind() -> ErrorKind.
In this way, we can better to encapsulate error details, and make error small.
## Rationale
Part of #1513
## Detailed Changes
Replace snafu-based Error to thiserror-based for memtable module.
## Test Plan
CI
---------
Co-authored-by: chunshao.rcs <[email protected]>
Describe This Problem
Currently, we rely on snafu to define/handle errors, there are some issues with current usage.
First, let me explain how error is defined within horaedb.
Enum
-style error, which contains detailed error informationcontext
to do the heavy work.This sounds like a good design pattern, but it become very verbose in practice. Some example:
Enum
-style error, which contains too many unnecessary item.All in all, enum based error design should be limited in some way.
Proposal
Error details should be opaque, if caller want to program based on it, the error provide a
pub fn kind() -> ErrorKind
.In this way, we can better to encapsulate error details, and make error small.
Additional Context
The text was updated successfully, but these errors were encountered: