Пример #1
0
 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;
     }));
 }
Пример #2
0
 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);
     });
 }
Пример #3
0
 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;
     }));
 }
Пример #4
0
 public static void ThrowIfZero(this int source, ErrorCodes error)
 {
     source.ThrowIfZero(() => PerpetuumException.Create(error));
 }