Table of Contents

Class OperationFailedException

Namespace
Excalibur.Data
Assembly
Excalibur.Data.Abstractions.dll

Represents an exception that is thrown when an operation fails to execute successfully on a specific resource.

public sealed class OperationFailedException : ResourceException, ISerializable
Inheritance
OperationFailedException
Implements
Inherited Members

Remarks

This exception can be used to encapsulate information about failed operations, including the name of the operation and the resource involved.

Constructors

OperationFailedException(string, int?, string?, Exception?)

Initializes a new instance of the ResourceException class with resource information.

public OperationFailedException(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.

OperationFailedException(string, string, int?, string?, Exception?)

Initializes a new instance of the OperationFailedException class.

public OperationFailedException(string operation, string resource, int? statusCode = null, string? message = null, Exception? innerException = null)

Parameters

operation string

The name of the operation that failed.

resource string

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

statusCode int?

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

message string

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

innerException Exception

The inner exception that caused this exception, if applicable.

Fields

DefaultMessage

The default error message for operation failures.

public const string DefaultMessage = "The operation failed."

Field Value

string

DefaultStatusCode

The default HTTP status code for operation failures.

public const int DefaultStatusCode = 500

Field Value

int

Properties

Operation

Gets or sets the name of the operation that failed.

public string Operation { get; set; }

Property Value

string

A string representing the operation name.