Table of Contents

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

resource string

The type or name of the resource associated with the error.

statusCode int?

The HTTP status code representing the error. Defaults to 404.

message string

A custom error message. Defaults to a generic message using the resource name.

innerException Exception

The 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

resourceKey string

The unique identifier for the resource that already exists.

resource string

The name or type of the resource that caused the conflict.

statusCode int?

The HTTP status code associated with the conflict. Defaults to DefaultStatusCode.

message string

A custom error message describing the conflict. Defaults to DefaultMessage.

innerException Exception

The 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

string

DefaultStatusCode

The default HTTP status code for resource already exists exceptions.

public const int DefaultStatusCode = 404

Field Value

int

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.