pub fn on_err<F, T, E>(f: F) -> impl Fn(Result<T, E>)where F: Fn(E) + 'static,
Calls the input function only if the returned functions result is an error.