-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnectionException.cs
More file actions
70 lines (63 loc) · 2.76 KB
/
ConnectionException.cs
File metadata and controls
70 lines (63 loc) · 2.76 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
namespace S7Tools.Core.Exceptions;
/// <summary>
/// Exception thrown when a connection-related error occurs (PLC, serial port, network, etc.).
/// </summary>
public class ConnectionException : S7ToolsException
{
/// <summary>
/// Gets the connection target (e.g., IP address, serial port name, etc.).
/// </summary>
public string? ConnectionTarget { get; init; }
/// <summary>
/// Gets the connection type (e.g., "PLC", "SerialPort", "TCP", etc.).
/// </summary>
public string? ConnectionType { get; init; }
/// <summary>
/// Initializes a new instance of the <see cref="ConnectionException"/> class.
/// </summary>
public ConnectionException()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ConnectionException"/> class with a specified error message.
/// </summary>
/// <param name="message">The message that describes the error.</param>
public ConnectionException(string message)
: base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ConnectionException"/> class with connection details.
/// </summary>
/// <param name="message">The message that describes the error.</param>
/// <param name="connectionTarget">The connection target (e.g., IP address, port name).</param>
/// <param name="connectionType">The connection type (e.g., "PLC", "SerialPort").</param>
public ConnectionException(string message, string connectionTarget, string connectionType)
: base(message)
{
ConnectionTarget = connectionTarget;
ConnectionType = connectionType;
}
/// <summary>
/// Initializes a new instance of the <see cref="ConnectionException"/> class with inner exception.
/// </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 ConnectionException(string message, Exception innerException)
: base(message, innerException)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ConnectionException"/> class with connection details and inner exception.
/// </summary>
/// <param name="message">The message that describes the error.</param>
/// <param name="connectionTarget">The connection target.</param>
/// <param name="connectionType">The connection type.</param>
/// <param name="innerException">The inner exception.</param>
public ConnectionException(string message, string connectionTarget, string connectionType, Exception innerException)
: base(message, innerException)
{
ConnectionTarget = connectionTarget;
ConnectionType = connectionType;
}
}