-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathChannelReadException.cs
More file actions
100 lines (92 loc) · 3.75 KB
/
ChannelReadException.cs
File metadata and controls
100 lines (92 loc) · 3.75 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
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
100
// =================================================================================================================================
// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
// =================================================================================================================================
using RapidField.SolidInstruments.Core.Extensions;
using System;
namespace RapidField.SolidInstruments.SignalProcessing
{
/// <summary>
/// Represents an exception that is raised while attempting to perform a read operation against an <see cref="IChannel{T}" />.
/// </summary>
public class ChannelReadException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="ChannelReadException" /> class.
/// </summary>
public ChannelReadException()
: this(message: null, innerException: null)
{
return;
}
/// <summary>
/// Initializes a new instance of the <see cref="ChannelReadException" /> class.
/// </summary>
/// <param name="channel">
/// The channel that could not be read.
/// </param>
public ChannelReadException(IChannel channel)
: this($"The channel, {channel.Name}, was unavailable.")
{
ChannelName = channel.Name;
}
/// <summary>
/// Initializes a new instance of the <see cref="ChannelReadException" /> class.
/// </summary>
/// <param name="channel">
/// The channel that could not be read.
/// </param>
/// <param name="innerException">
/// The exception that is the cause of the current exception.
/// </param>
public ChannelReadException(IChannel channel, Exception innerException)
: this($"An exception was raised while attempting to read the channel {channel.Name}.", innerException)
{
ChannelName = channel.Name;
}
/// <summary>
/// Initializes a new instance of the <see cref="ChannelReadException" /> class.
/// </summary>
/// <param name="message">
/// The error message that explains the reason for the exception.
/// </param>
public ChannelReadException(String message)
: this(message, null)
{
return;
}
/// <summary>
/// Initializes a new instance of the <see cref="ChannelReadException" /> class.
/// </summary>
/// <param name="innerException">
/// The exception that is the cause of the current exception.
/// </param>
public ChannelReadException(Exception innerException)
: this(message: null, innerException: innerException)
{
return;
}
/// <summary>
/// Initializes a new instance of the <see cref="ChannelReadException" /> class.
/// </summary>
/// <param name="message">
/// The error message that explains the reason for the exception.
/// </param>
/// <param name="innerException">
/// The exception that is the cause of the current exception.
/// </param>
public ChannelReadException(String message, Exception innerException)
: base(message.IsNullOrEmpty() ? "An exception was raised while attempting to read a channel." : message, innerException)
{
ChannelName = null;
}
/// <summary>
/// Gets or sets the name of the channel that could not be read; or <see langword="null" /> if the name of the channel is
/// unknown.
/// </summary>
public String ChannelName
{
get;
set;
}
}
}