-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPhantomException.cs
36 lines (30 loc) · 1.01 KB
/
PhantomException.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
using System;
using System.Runtime.Serialization;
namespace Phantomity.Utils
{
[Serializable]
public class PhantomException : InvalidOperationException, ISerializable
{
public PhantomErrorCode ErrorCode { get; private set; }
private static string CreateMessage(PhantomErrorCode code, string message)
{
return $"Phantom error {code}: {message}";
}
public PhantomException(PhantomErrorCode errorCode, string message) : base(CreateMessage(errorCode, message))
{
ErrorCode = errorCode;
}
protected PhantomException(SerializationInfo serializationInfo, StreamingContext streamingContext)
: base(serializationInfo, streamingContext)
{
}
void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
base.GetObjectData(serializationInfo, streamingContext);
}
public override void GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
{
base.GetObjectData(serializationInfo, streamingContext);
}
}
}