Class ResourceAlreadyExistsException
- Namespace
- Excalibur.Data.Exceptions
- Assembly
- Excalibur.Data.dll
Represents an exception that is thrown when attempting to create a resource that already exists.
public sealed class ResourceAlreadyExistsException : ResourceException, ISerializable
- Inheritance
-
ResourceAlreadyExistsException
- Implements
- Inherited Members
Remarks
This exception is typically used to indicate that an operation could not proceed because a resource with the same key already exists in the system.
Constructors
ResourceAlreadyExistsException(string, int?, string?, Exception?)
Initializes a new instance of the ResourceException class with resource information.
public ResourceAlreadyExistsException(string resource, int? statusCode, string? message = null, Exception? innerException = null)
Parameters
resourcestringThe type or name of the resource associated with the error.
statusCodeint?The HTTP status code representing the error. Defaults to 404.
messagestringA custom error message. Defaults to a generic message using the resource name.
innerExceptionExceptionThe inner exception that caused this exception, if applicable.
ResourceAlreadyExistsException(string, string, int?, string?, Exception?)
Initializes a new instance of the ResourceAlreadyExistsException class.
public ResourceAlreadyExistsException(string resourceKey, string resource, int? statusCode = null, string? message = null, Exception? innerException = null)
Parameters
resourceKeystringThe unique identifier for the resource that already exists.
resourcestringThe name or type of the resource that caused the conflict.
statusCodeint?The HTTP status code associated with the conflict. Defaults to DefaultStatusCode.
messagestringA custom error message describing the conflict. Defaults to DefaultMessage.
innerExceptionExceptionThe inner exception that caused this exception, if applicable.
Fields
DefaultMessage
The default error message for resource already exists exceptions.
public const string DefaultMessage = "The specified resource was not found."
Field Value
DefaultStatusCode
The default HTTP status code for resource already exists exceptions.
public const int DefaultStatusCode = 404
Field Value
Properties
ResourceKey
Gets or sets the unique identifier for the resource that caused the conflict.
public string ResourceKey { get; set; }
Property Value
- string
A string representing the resource key.