-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExceptionsHandler.cs
More file actions
34 lines (30 loc) · 946 Bytes
/
ExceptionsHandler.cs
File metadata and controls
34 lines (30 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// <copyright file="ExceptionsHandler.cs" company="Tortillas-Inc">
// Copy me, no rights reserved.
// </copyright>
namespace SearchInWordFiles
{
using System;
/// <summary>
/// Class used to manage exceptions.
/// </summary>
public class ExceptionsHandler
{
/// <summary>
/// Regroup every exception messages of an exception (Exception and inner exception).
/// </summary>
/// <param name="exception">Exception whose messages are going to be grouped.</param>
/// <returns>String with grouped messages.</returns>
public static string ConcatException(Exception exception)
{
string message = string.Empty;
Exception ex = exception;
do
{
message += ex.Message + "\n";
ex = ex.InnerException;
}
while (ex != null);
return message;
}
}
}