-
Notifications
You must be signed in to change notification settings - Fork 0
/
UbikException.cs
99 lines (86 loc) · 2.76 KB
/
UbikException.cs
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;
using System.Collections.Generic;
using System.Text;
namespace Ubik
{
/// <summary>
/// Generic script engine exception.
/// </summary>
public class UbikException
: Exception
{
#region Private Variables
private String m_strMessage;
private Exception m_exceptionInner;
#endregion
#region Public Methods
/// <summary>
/// Constructs an exception
/// </summary>
public UbikException()
{
m_strMessage = "No details specified.";
m_exceptionInner = null;
}
/// <summary>
/// Constructs an exception with the given message.
/// </summary>
/// <param name="strMessage">Exception message.</param>
public UbikException(String strMessage)
{
m_strMessage = strMessage;
m_exceptionInner = null;
}
/// <summary>
/// Constructs an exception with the given message
/// and inner exception reference.
/// </summary>
/// <param name="strMessage">Exception message.</param>
/// <param name="exceptionInner">Inner exception reference.</param>
public UbikException(String strMessage, Exception exceptionInner)
{
m_strMessage = strMessage;
m_exceptionInner = exceptionInner;
}
/// <summary>
/// Returns a string representation of the exception.
/// </summary>
/// <returns>A string representation of the exception.</returns>
public override string ToString()
{
return MessageTrace;
}
#endregion
#region Public Properties
/// <summary>
/// Exception message.
/// </summary>
public new String Message
{
get { return m_strMessage; }
}
/// <summary>
/// Complete message trace recursively including any
/// inner exceptions.
/// </summary>
public String MessageTrace
{
get
{
if (m_exceptionInner != null)
{
String strMessageTrace = m_strMessage + " Reason: ";
if (typeof(UbikException).IsAssignableFrom(
m_exceptionInner.GetType()))
strMessageTrace += ((UbikException) m_exceptionInner).MessageTrace;
else
strMessageTrace += m_exceptionInner.Message;
return strMessageTrace;
}
else
return m_strMessage;
}
}
#endregion
}
}