Click or drag to resize

SafeCallbacksFuncT Method

Executes a function, intercepting any exceptions that it rises.

Namespace:  KSPDev.ProcessingUtils
Assembly:  KSPDev_Utils.2.5 (in KSPDev_Utils.2.5.dll) Version: 2.5 for KSP v1
Syntax
C#
public static T Func<T>(
	Func<T> fn,
	T failValue
)
Request Example View Source

Parameters

fn
Type: SystemFuncT
The function to call.
failValue
Type: T
The value that will be returned in case of the function has failed.

Type Parameters

T
The return type.

Return Value

Type: T
The function return value or failValue if it failed.
Remarks
The exceptions that the callback may rise are logged as errors, but the flow is not get interrupted. Such behavior may be handy when calling cleanup methods or notifying multiple recepients where the failure is not an option.
See Also