public static void IfTrueThenThrow <T, TException>(this BooleanVal <T> @this, Dictionary <string, IArgDescriptionVal> exceptionParams) where TException : Exception { @this.IfTrue(_ => ExceptionBuilder.Create <TException>().BuildAndThrow(exceptionParams)); }
/// <summary> /// If true then throw exception /// </summary> /// <param name="this"></param> /// <param name="exception"></param> public static void IfTrueThenThrow <T>(this BooleanVal <T> @this, Exception exception) { @this.IfTrue(_ => ExceptionHelper.PrepareForRethrow(exception)); }
public static void IfTrueThenThrow <T, TException>(this BooleanVal <T> @this) where TException : Exception { @this.IfTrue(_ => ExceptionBuilder.Create <TException>().BuildAndThrow()); }
/// <summary> /// If true then throw exception /// </summary> /// <param name="this"></param> /// <param name="exceptionFunc"></param> public static void IfTrueThenThrow <T>(this BooleanVal <T> @this, Func <T, Exception> exceptionFunc) { @this.IfTrue(val => ExceptionHelper.PrepareForRethrow(exceptionFunc.Invoke(val))); }