feat: add a generic error type #47
Conversation
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
| /// # Errors | ||
| /// | ||
| /// If k is less than 10, returns [`ErrorKind::InvalidArgument`]. | ||
| pub fn try_new(k: u16) -> Result<Self, Error> { |
There was a problem hiding this comment.
Demonstrate how a fallible version can be made.
We may later apply the same to cdf/pmf/rank/quantile.
| kind: ErrorKind, | ||
| message: String, | ||
| context: Vec<(&'static str, String)>, | ||
| source: Option<anyhow::Error>, |
There was a problem hiding this comment.
Can't source just be a Box<dyn Error> + (Sync + Send if needed)?
There was a problem hiding this comment.
IIRC the auto convesion (From/Into) will have some trouble. I ever try to replace anyhow::Error with box dyn Error + Send/Sync in OpenDAL, but it ruins the experience and I remember some compile failure.
However, we don't depend on source error now. So now, I tend to remove this feature as well as the anyhow dependency. When we need it, we can add it back and evaluate the solution at that moment.
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
|
cc @leerho This PR should be mergeable now. |
leerho
left a comment
There was a problem hiding this comment.
Tisonkun gave his Thumbs-up, which is good for me.
This closes #46.
cc @notfilippo @Xuanwo @ZENOTME @PsiACE