catchError<T> static method

Future<SupaResult<T>> catchError<T>(
  1. Future<T> func()
)

Implementation

static Future<SupaResult<T>> catchError<T>(Future<T> Function() func) async {
  try {
    final result = await func();
    return SupaResult.success(response: result);
  } catch (e) {
    return SupaResult.failure(error: NetworkExceptions.getException(e));
  }
}