Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Static method: TResult OnExceptionRetryThenDefault<TResult>(Func<TResult>, TResult, int, int)

  • Declared in: RT.Util.Ut

Declaration

public static TResult OnExceptionRetryThenDefault<TResult>(
    Func<TResult> func,
    TResult default,
    int attempts = 3,
    int delayMs = 333
)

Summary

Evaluates the specified code and returns its result. If the code throws any exceptions, retries the specified number of times. If the code still throws on the final attempt, returns default instead.

Generic type parameters

TResultThis type parameter is not documented.

Parameters

Func<TResult>func The code to be executed.
TResultdefault Value to return in case of failure.
intattempts The maximum number of times to retry func before giving up.
intdelayMs Delay, in milliseconds, before retrying func.