Class AlreadyExistsException
- Namespace
- VpnHood.Net.Toolkit.Exceptions
- Assembly
- VpnHood.Net.Toolkit.dll
The exception that is thrown when an object to add already exists. Its Data carries
HttpStatusCode 409, for an API that maps it to its response.
public sealed class AlreadyExistsException : Exception, ISerializable
- Inheritance
-
AlreadyExistsException
- Implements
- Inherited Members
Constructors
AlreadyExistsException(string)
Initializes a new instance of the AlreadyExistsException class.
public AlreadyExistsException(string collectionName)
Parameters
collectionNamestringThe name of the collection the object exists in.
AlreadyExistsException(string, Exception)
Initializes a new instance of the AlreadyExistsException class.
public AlreadyExistsException(string collectionName, Exception innerException)
Parameters
collectionNamestringThe name of the collection the object exists in.
innerExceptionExceptionThe exception that is the cause of this one.
Properties
CollectionName
Gets the name of the collection the object exists in; empty for an exception rebuilt from an API's error, which carries the message alone.
public string CollectionName { get; }
Property Value
Methods
Is(Exception)
Determines, by a heuristic, whether an exception, or one of its inner exceptions, tells that an object already exists: an AlreadyExistsException, a SQL Server error 2601 or 2627 in its data, or SQLite's "UNIQUE constraint failed" in its message.
public static bool Is(Exception ex)
Parameters
exExceptionThe exception.