aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Logging/ExtensionMethods
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-02-12 12:53:46 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-02-12 12:53:46 +0200
commit8231c057a4073e7397dbb1d953c43a76d8187e72 (patch)
tree1c40c8497aac2f10f919ab732af0c357493ca320 /Software/Visual_Studio/Tango.Logging/ExtensionMethods
parent2bef1ef7fb1d5cd57e2af3f47a648e512cfcd4f2 (diff)
downloadTango-8231c057a4073e7397dbb1d953c43a76d8187e72.tar.gz
Tango-8231c057a4073e7397dbb1d953c43a76d8187e72.zip
Implemented global exception trapping on machine studio.
Diffstat (limited to 'Software/Visual_Studio/Tango.Logging/ExtensionMethods')
-rw-r--r--Software/Visual_Studio/Tango.Logging/ExtensionMethods/ExceptionExtensions.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Logging/ExtensionMethods/ExceptionExtensions.cs b/Software/Visual_Studio/Tango.Logging/ExtensionMethods/ExceptionExtensions.cs
new file mode 100644
index 000000000..d3a824a90
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Logging/ExtensionMethods/ExceptionExtensions.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.Logging
+{
+ /// <summary>
+ /// Contains <see cref="Exception"/> exception methods.
+ /// </summary>
+ public static class ExceptionExtensions
+ {
+ /// <summary>
+ /// Flattens the exception by digging on InnerException.
+ /// </summary>
+ /// <param name="exception">The exception.</param>
+ /// <returns></returns>
+ public static String FlattenException(this Exception exception)
+ {
+ var stringBuilder = new StringBuilder();
+
+ while (exception != null)
+ {
+ stringBuilder.AppendLine(exception.Message);
+ stringBuilder.AppendLine(exception.StackTrace);
+
+ exception = exception.InnerException;
+ }
+
+ return stringBuilder.ToString();
+ }
+ }
+}
+