Open nicolas-guichard opened 5 hours ago
Currently, ServerFnError has a blanket From impl to convert from E, but only with the default NoCustomError type:
ServerFnError
From
E
NoCustomError
impl<E: std::error::Error> From<E> for ServerFnError { fn from(value: E) -> Self { ServerFnError::ServerError(value.to_string()) } }
This means we can't easily use ? to convert other errors into a ServerFnError<MyCustomError>.
?
ServerFnError<MyCustomError>
Instead I think we should provide a blanket impl for any T:
T
impl<T, E: std::error::Error> From<E> for ServerFnError<T> { fn from(value: E) -> Self { ServerFnError::ServerError(value.to_string()) } }
Feel free to make a PR.
Currently,
ServerFnError
has a blanketFrom
impl to convert fromE
, but only with the defaultNoCustomError
type:This means we can't easily use
?
to convert other errors into aServerFnError<MyCustomError>
.Instead I think we should provide a blanket impl for any
T
: