 | ISuppressSwallowAsyncT Method (FuncTaskT, T) |
Runs the provided async function and returns its result. If exception is thrown, it is logged at Error level.
Exception is not propagated outside of this method. Fallback value is returned instead.
Namespace: NLogAssembly: NLog (in NLog.dll) Version: 0.0.0.0
SyntaxTask<T> SwallowAsync<T>(
Func<Task<T>> asyncFunc,
T fallback
)
Function SwallowAsync(Of T) (
asyncFunc As Func(Of Task(Of T)),
fallback As T
) As Task(Of T)
Parameters
- asyncFunc
- Type: SystemFuncTaskT
Async function to run. - fallback
- Type: T
Fallback value to return in case of exception. Defaults to default value of type T.
Type Parameters
- T
- Return type of the provided function.
Return Value
Type:
TaskTResult returned by the provided function or fallback value in case of exception.
See Also