BotException.cs
1 using System;
2 using System.Text;
3 
4 namespace Microsoft.Bot.Builder.Calling.Exceptions
5 {
9  public class BotException : Exception
10  {
11  #region Constructors and Destructors
12 
16  public BotException()
17  {
18  }
19 
24  public BotException(string message) : base(message)
25  {
26  }
27 
37  public BotException(string message, Exception innerException, bool extendForInternalExceptionRemark = true)
38  : base(
39  extendForInternalExceptionRemark ? ExtendMessageWithInternalExceptionDetails(message, innerException) : message,
40  innerException)
41  {
42  }
43 
44  #endregion
45 
46  #region Methods
47 
48  private static string ExtendMessageWithInternalExceptionDetails(string message, Exception innerException)
49  {
50  StringBuilder builder = new StringBuilder();
51  if (message != null) builder.Append(message);
52  if (innerException != null)
53  {
54  if (message != null) builder.Append(", error: ");
55  builder.Append(innerException.Message);
56  builder.Append(" (see inner exception for details)");
57  }
58 
59  return builder.ToString();
60  }
61 
62  #endregion
63  }
64 }
BotException(string message, Exception innerException, bool extendForInternalExceptionRemark=true)
wraps an exception into the BotException
Definition: BotException.cs:37
BotException(string message)
creates a new BotException
Definition: BotException.cs:24
base exceptions for all exceptions thrown by the bots core library
Definition: BotException.cs:9