-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDependencyQueueCycleError.cs
More file actions
55 lines (48 loc) · 1.72 KB
/
Copy pathDependencyQueueCycleError.cs
File metadata and controls
55 lines (48 loc) · 1.72 KB
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
// Copyright Subatomix Research Inc.
// SPDX-License-Identifier: MIT
namespace DependencyQueue;
/// <summary>
/// A <see cref="DependencyQueue{T}"/> validation error that occurs when the
/// dependency graph contains a cycle.
/// </summary>
/// <typeparam name="T">
/// The type of values contained in queue items.
/// </typeparam>
public class DependencyQueueCycleError<T> : DependencyQueueError
{
internal DependencyQueueCycleError(
DependencyQueueItem<T> requiringItem,
DependencyQueueTopic<T> requiredTopic)
{
if (requiringItem is null)
throw Errors.ArgumentNull(nameof(requiringItem));
if (requiredTopic is null)
throw Errors.ArgumentNull(nameof(requiredTopic));
RequiringItem = requiringItem;
RequiredTopic = requiredTopic;
}
/// <inheritdoc/>
public override DependencyQueueErrorType Type
=> DependencyQueueErrorType.Cycle;
/// <summary>
/// Gets the item whose requirement of <see cref="RequiredTopic"/>
/// creates a cycle in the dependency graph.
/// </summary>
public DependencyQueueItem<T> RequiringItem { get; }
/// <summary>
/// Gets the topic whose requirement by <see cref="RequiringItem"/>
/// creates a cycle in the dependency graph.
/// </summary>
public DependencyQueueTopic<T> RequiredTopic { get; }
/// <inheritdoc/>
public override string ToString()
{
return string.Format(
"The item '{0}' cannot require topic '{1}' because " +
"an item providing that topic already requires item '{0}'. " +
"The dependency graph does not permit cycles.",
RequiringItem.Name,
RequiredTopic.Name
);
}
}