The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
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.

ExceptionExtensions.cs 726B

123456789101112131415161718192021222324
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. namespace Teknik.Helpers
  6. {
  7. public static class ExceptionExtensions
  8. {
  9. public static string GetFullMessage(this Exception ex, bool recursive = false, bool stackTrace = false)
  10. {
  11. string message = ex.Message;
  12. if (recursive && ex.InnerException != null)
  13. {
  14. message += " | Inner Exception: " + ex.InnerException.GetFullMessage(recursive, stackTrace);
  15. }
  16. if (stackTrace && !string.IsNullOrEmpty(ex.StackTrace))
  17. {
  18. message += " | Stack Trace: " + ex.StackTrace;
  19. }
  20. return message;
  21. }
  22. }
  23. }