Class DomainException
- Namespace
- Arbiter.CommandQuery
- Assembly
- Arbiter.CommandQuery.dll
Represents an exception that occurs within the domain layer of the application.
public class DomainException : Exception, ISerializable
- Inheritance
-
DomainException
- Implements
- Inherited Members
- Extension Methods
Remarks
This exception is typically used to represent errors that occur in the domain logic of the application. It includes an HTTP status code and optional error details.
Constructors
DomainException()
Initializes a new instance of the DomainException class with a default message and status code 500 (Internal Server Error).
public DomainException()
DomainException(int, string?)
Initializes a new instance of the DomainException class with a specified status code and message.
public DomainException(int statusCode, string? message)
Parameters
DomainException(int, string?, Exception?)
Initializes a new instance of the DomainException class with a specified status code, message, and inner exception.
public DomainException(int statusCode, string? message, Exception? innerException)
Parameters
statusCode
intThe status code for the error.
message
stringThe message that describes the error.
innerException
ExceptionThe exception that is the cause of the current exception.
DomainException(HttpStatusCode, string?)
Initializes a new instance of the DomainException class with a specified HTTP status code and message.
public DomainException(HttpStatusCode statusCode, string? message)
Parameters
statusCode
HttpStatusCodeThe HTTP status code for the error.
message
stringThe message that describes the error.
DomainException(HttpStatusCode, string?, Exception?)
Initializes a new instance of the DomainException class with a specified HTTP status code, message, and inner exception.
public DomainException(HttpStatusCode statusCode, string? message, Exception? innerException)
Parameters
statusCode
HttpStatusCodeThe HTTP status code for the error.
message
stringThe message that describes the error.
innerException
ExceptionThe exception that is the cause of the current exception.
DomainException(string?)
Initializes a new instance of the DomainException class with a specified message and status code 500 (Internal Server Error).
public DomainException(string? message)
Parameters
message
stringThe message that describes the error.
DomainException(string?, Exception?)
Initializes a new instance of the DomainException class with a specified message, inner exception, and status code 500 (Internal Server Error).
public DomainException(string? message, Exception? innerException)
Parameters
message
stringThe message that describes the error.
innerException
ExceptionThe exception that is the cause of the current exception.
Properties
Errors
Gets or sets the errors associated with the domain exception.
public IDictionary<string, string[]>? Errors { get; set; }
Property Value
- IDictionary<string, string[]>
A dictionary where the key is the property name, and the value is an array of error messages.
StatusCode
Gets the status code associated with the exception.
public int StatusCode { get; }
Property Value
- int
The HTTP or custom status code representing the error.