Common Logging 2.0 API Reference

ArgUtils.Guard(T) Method

Ensures any exception thrown by the given function is wrapped with an ConfigurationException.

[Visual Basic]
Public Shared Sub Guard(Of T)( _
   ByVal function As Function(Of T), _
   ByVal messageFormat As String, _
   ParamArray args As Object _
)
[C#]
public static T Guard<T>(
   Function<T> function,
   string messageFormat,
   params object[] args
);

Parameters

function
the action to execute
messageFormat
the message to be set on the thrown ConfigurationException
args
args to be passed to Format to format the message

Remarks

If function already throws a ConfigurationException, it will not be wrapped.

See Also

ArgUtils Class | Common.Logging.Configuration Namespace