You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LuExceptionsExtensions.cs 491B

123456789101112131415161718192021
  1. using Luticate2.Auth.Dbo.Result;
  2. namespace Luticate2.Auth.Exceptions
  3. {
  4. public static class LuExceptionsExtensions
  5. {
  6. public static void Throw<T>(this LuResult<T> result)
  7. {
  8. throw new LuResultException(result.To<object>());
  9. }
  10. public static LuResult<T> ThrowIfNotSuccess<T>(this LuResult<T> result)
  11. {
  12. if (!result)
  13. {
  14. result.Throw();
  15. }
  16. return result;
  17. }
  18. }
  19. }