Class ErrorOptions
error response customization settings
Inheritance
Inherited Members
Namespace: FastEndpoints
Assembly: FastEndpoints.dll
Syntax
public class ErrorOptions
Properties
GeneralErrorsField
the general errors field name. this is the field name used for general errors when AddError() method is called without specifying a request dto property.
Declaration
public string GeneralErrorsField { set; }
Property Value
Type | Description |
---|---|
System.String |
ProducesMetadataType
if this property is set, a Microsoft.AspNetCore.Http.Metadata.IProducesResponseTypeMetadata will automatically be added to any endpoints that has a Validator<TRequest> associated with it.
if you're not specifying your own ResponseBuilder, you'd typically be setting this to typeOf(ErrorResponse)
Declaration
public Type ProducesMetadataType { set; }
Property Value
Type | Description |
---|---|
System.Type |
ResponseBuilder
a function for transforming validation errors to an error response dto. set it to any func that returns an object that can be serialized to json. this function will be run everytime an error response needs to be sent to the client. the arguments for the func will be a list of validation failures, the http context and an http status code.
Declaration
public Func<List<ValidationFailure>, HttpContext, int, object> ResponseBuilder { set; }
Property Value
Type | Description |
---|---|
System.Func<System.Collections.Generic.List<FluentValidation.Results.ValidationFailure>, Microsoft.AspNetCore.Http.HttpContext, System.Int32, System.Object> |
StatusCode
this http status code will be used for all automatically sent validation failure responses. defaults to 400.
Declaration
public int StatusCode { set; }
Property Value
Type | Description |
---|---|
System.Int32 |