-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefaultProfileDeletionException.cs
More file actions
46 lines (42 loc) · 1.97 KB
/
DefaultProfileDeletionException.cs
File metadata and controls
46 lines (42 loc) · 1.97 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
namespace S7Tools.Core.Exceptions;
/// <summary>
/// Exception thrown when attempting to delete a profile that is marked as the default profile.
/// Default profiles cannot be deleted to ensure at least one profile always exists.
/// </summary>
public class DefaultProfileDeletionException : ProfileException
{
/// <summary>
/// Initializes a new instance of the <see cref="DefaultProfileDeletionException"/> class.
/// </summary>
/// <param name="profileId">The ID of the default profile that cannot be deleted.</param>
public DefaultProfileDeletionException(int profileId)
: base($"Cannot delete the default profile (ID: {profileId}). Set another profile as default first.", profileId)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DefaultProfileDeletionException"/> class with profile name.
/// </summary>
/// <param name="profileId">The ID of the default profile that cannot be deleted.</param>
/// <param name="profileName">The name of the default profile.</param>
public DefaultProfileDeletionException(int profileId, string profileName)
: base($"Cannot delete the default profile '{profileName}' (ID: {profileId}). Set another profile as default first.", profileId, profileName)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DefaultProfileDeletionException"/> class with a custom message.
/// </summary>
/// <param name="message">The custom error message.</param>
public DefaultProfileDeletionException(string message)
: base(message)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DefaultProfileDeletionException"/> class with inner exception.
/// </summary>
/// <param name="message">The error message.</param>
/// <param name="innerException">The inner exception.</param>
public DefaultProfileDeletionException(string message, Exception innerException)
: base(message, innerException)
{
}
}