Class ErrorResponse
the dto used to send an error response to the client
Implements
Inherited Members
Namespace: FastEndpoints
Assembly: FastEndpoints.dll
Syntax
public sealed class ErrorResponse : IResult
Constructors
ErrorResponse()
instantiate a new error response without any errors
Declaration
public ErrorResponse()
ErrorResponse(List<ValidationFailure>, int)
instantiate an error response with the given collection validation failures
Declaration
public ErrorResponse(List<ValidationFailure> failures, int statusCode = 400)
Parameters
Type | Name | Description |
---|---|---|
List<ValidationFailure> | failures | validation failures to initialize the DTO with |
int | statusCode |
Properties
Errors
the collection of errors for the current context
Declaration
public Dictionary<string, List<string>> Errors { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<string, List<string>> |
Message
the message for the error response
Declaration
public string Message { get; set; }
Property Value
Type | Description |
---|---|
string |
StatusCode
the http status code sent to the client. default is 400.
Declaration
public int StatusCode { get; set; }
Property Value
Type | Description |
---|---|
int |
Methods
ExecuteAsync(HttpContext)
Write an HTTP response reflecting the result.
Declaration
public Task ExecuteAsync(HttpContext httpContext)
Parameters
Type | Name | Description |
---|---|---|
HttpContext | httpContext | The HttpContext for the current request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous execute operation. |