Search Results for

    Show / Hide Table of Contents

    Class ErrorResponse

    the dto used to send an error response to the client

    Inheritance
    object
    ErrorResponse
    Implements
    IResult
    IEndpointMetadataProvider
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: FastEndpoints
    Assembly: FastEndpoints.dll
    Syntax
    public sealed class ErrorResponse : IResult, IEndpointMetadataProvider

    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.

    PopulateMetadata(MethodInfo, EndpointBuilder)

    Populates metadata for the related Endpoint and MethodInfo.

    Declaration
    public static void PopulateMetadata(MethodInfo _, EndpointBuilder builder)
    Parameters
    Type Name Description
    MethodInfo _
    EndpointBuilder builder

    The EndpointBuilder used to construct the endpoint for the given method.

    Remarks

    This method is called by RequestDelegateFactory when creating a RequestDelegate and by MVC when creating endpoints for controller actions. This is called for each parameter and return type of the route handler or action with a declared type implementing this interface. Add or remove objects on the Metadata property of the builder to modify the Metadata being built.

    Implements

    IResult
    IEndpointMetadataProvider
    In this article
    Back to top Developed by Đĵ ΝιΓΞΗΛψΚ and contributors / Licensed under MIT / Website generated by DocFX