retryOnPossibleEpochChange<T> method

Future<T> retryOnPossibleEpochChange<T>(
  1. Future<T> fn()
)

Retry a function once if it throws RetryableWalrusClientError.

On a retryable error (e.g. epoch change), resets cached state and retries the call. Mirrors the TS SDK's #retryOnPossibleEpochChange.

Implementation

Future<T> retryOnPossibleEpochChange<T>(Future<T> Function() fn) async {
  try {
    return await fn();
  } on RetryableWalrusClientError {
    reset();
    return await fn();
  }
}