public static ErrorCodes ThrowIfError(this ErrorCodes error, [InstantHandle] Action <PerpetuumException> exceptionAction = null) { return(error.ThrowIfNotEqual(ErrorCodes.NoError, () => { var gex = PerpetuumException.Create(error); exceptionAction?.Invoke(gex); return gex; })); }
public static void ThrowIfTrue(this bool value, ErrorCodes error, [InstantHandle] Action <PerpetuumException> exceptionAction = null) { value.ThrowIfTrue(() => { var gex = PerpetuumException.Create(error); exceptionAction?.Invoke(gex); return(gex); }); }
public static T ThrowIfNull <T>(this T source, ErrorCodes error, [InstantHandle] Action <PerpetuumException> exceptionAction = null) { return(source.ThrowIfNull(() => { var gex = PerpetuumException.Create(error); exceptionAction?.Invoke(gex); return gex; })); }
public static void ThrowIfZero(this int source, ErrorCodes error) { source.ThrowIfZero(() => PerpetuumException.Create(error)); }