-
Notifications
You must be signed in to change notification settings - Fork 1
/
DelegateException.cs
37 lines (36 loc) · 1.69 KB
/
DelegateException.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
using System;
using JetBrains.Annotations;
namespace HpTimeStamps
{
/// <summary>
/// Exception that is thrown to indicate a supplied
/// delegate has not fulfilled its contract with the entity
/// to which it has been supplied.
/// </summary>
public abstract class DelegateException : Exception
{
/// <summary>
/// The offending delegate
/// </summary>
[NotNull] public Delegate OffendingDelegate { get; }
/// <summary>
/// The name of the offending delegate
/// </summary>
[NotNull] public string DelegateName { get; }
/// <summary>
/// CTOR
/// </summary>
/// <param name="message">message</param>
/// <param name="offendingDelegateName">name of the offending delegate</param>
/// <param name="offendingDelegate">the offending delegate</param>
/// <param name="inner">if another exception is the cause of this exception, it should go here.</param>
/// One or more of <exception cref="ArgumentNullException"><paramref name="message"/>, <paramref name="offendingDelegateName"/>, and
/// <paramref name="offendingDelegate"/> was null</exception>
protected DelegateException([NotNull] string message, [NotNull] string offendingDelegateName,
[NotNull] Delegate offendingDelegate, [CanBeNull] Exception inner) : base(message ?? throw new ArgumentNullException(nameof(message)), inner)
{
OffendingDelegate = offendingDelegate ?? throw new ArgumentNullException(nameof(offendingDelegate));
DelegateName = offendingDelegateName ?? throw new ArgumentNullException(nameof(offendingDelegateName));
}
}
}