tryRunEither<T> static method
Implementation
static FutureOr<KResult<T>> tryRunEither<T>(FutureOr<T?> Function() operation, {bool logError = true}) async {
try {
return KResult.success((await operation()) as T);
} catch (e, st) {
if (logError) {
log("Result tryRunEither error: ${e.toString()}", error: e, stackTrace: st);
}
return KResult.error(e.toString(), st, logError);
}
}