Skip to content

Commit

Permalink
refactor: Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmah309 committed Jul 2, 2024
1 parent 79779ef commit 1658bcc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/src/anyhow/execute_protected.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ import 'package:anyhow/anyhow.dart';
Result<S> executeProtected<S>(S Function() func) => guard(func);

@Deprecated("Use 'guardResult' instead")
Result<S> executeProtectedResult<S>(Result<S> Function() func) => guardResult(func);
Result<S> executeProtectedResult<S>(Result<S> Function() func) =>
guardResult(func);

@Deprecated("Use 'guardAsync' instead")
FutureResult<S> executeProtectedAsync<S>(Future<S> Function() func) => guardAsync<S>(func);
FutureResult<S> executeProtectedAsync<S>(Future<S> Function() func) =>
guardAsync<S>(func);

@Deprecated("Use 'guardAsyncResult' instead")
FutureResult<S> executeProtectedAsyncResult<S>(
Future<Result<S>> Function() func) => guardAsyncResult(func);
Future<Result<S>> Function() func) =>
guardAsyncResult(func);

/// Executes the function in a protected context. [func] is called inside a try catch block. If the result is not
/// catch, then return value [func] returned inside an [Ok]. If [func] throws, then the thrown value is returned
Expand Down Expand Up @@ -47,8 +50,7 @@ FutureResult<S> guardAsync<S>(Future<S> Function() func) async {
}

/// Async version of [guardResult]
FutureResult<S> guardAsyncResult<S>(
Future<Result<S>> Function() func) async {
FutureResult<S> guardAsyncResult<S>(Future<Result<S>> Function() func) async {
try {
return await func();
} catch (e) {
Expand Down

0 comments on commit 1658bcc

Please sign in to comment.