ExceptionHelper.cs 821 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Bowin.Common.Exceptions
  6. {
  7. public class ExceptionHelper
  8. {
  9. public static System.Data.SqlClient.SqlException GetSqlException(Exception ex)
  10. {
  11. if (ex is System.Data.SqlClient.SqlException)
  12. return (System.Data.SqlClient.SqlException)ex;
  13. if (ex.InnerException == null)
  14. return null;
  15. else
  16. return GetSqlException(ex.InnerException);
  17. }
  18. }
  19. public class SuccessException : Exception
  20. {
  21. public SuccessException(string message)
  22. : base(message)
  23. {
  24. }
  25. public SuccessException(string message, Exception ex)
  26. : base(message, ex)
  27. {
  28. }
  29. }
  30. }