lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

Remove `unknown` error type

Open Nutomic opened this issue 2 years ago • 1 comments

This error type is used in some random places, sometimes without any error message. It makes debugging unnecessarily complicated and could be removed using more specific error types and .map_err().

Here is the definition

Some examples of unknown errors being reported: https://lemmy.ml/post/10371837 https://github.com/LemmyNet/lemmy/issues/4368 https://github.com/LemmyNet/lemmy/blob/main/crates/apub/src/lib.rs#L51

Nutomic avatar Jan 12 '24 15:01 Nutomic

Importantly the unknown error type is used to convert anyhow errors to LemmyError. So to get rid of it we would have to convert all kinds of errors manually, for example:

impl From<ParseIntError> for LemmyError {}
impl From<html2text::Error> for LemmyError {}
impl From<std::io::Error> for LemmyError {}
...

This would take a lot of boilerplate code unless there is a macro to handle it. Anyway it doesnt require a breaking change and can be done after 1.0

Nutomic avatar Mar 04 '25 13:03 Nutomic