Table of Contents

Class HtmxErrorResult

Namespace
Htmx.Components.ViewResults
Assembly
Htmx.Components.dll

Returns a structured, user-safe HTMX error fragment.

public sealed class HtmxErrorResult : ContentResult, IStatusCodeActionResult, IActionResult
Inheritance
HtmxErrorResult
Implements
Inherited Members
Extension Methods

Constructors

HtmxErrorResult(int, HtmxErrorFragment)

Initializes a new structured HTMX error result.

public HtmxErrorResult(int statusCode, HtmxErrorFragment error)

Parameters

statusCode int

The HTTP status code for the response.

error HtmxErrorFragment

The user-safe error fragment to render.

Methods

Crud(string, string?)

Creates a CRUD operation error response.

public static HtmxErrorResult Crud(string message, string? componentId = null)

Parameters

message string

The user-safe operation message.

componentId string

The optional component id that owns the error.

Returns

HtmxErrorResult

Forbidden(string?)

Creates a forbidden error response.

public static HtmxErrorResult Forbidden(string? componentId = null)

Parameters

componentId string

The optional component id that owns the error.

Returns

HtmxErrorResult

InternalServerError(string?)

Creates an internal server error response.

public static HtmxErrorResult InternalServerError(string? componentId = null)

Parameters

componentId string

The optional component id that owns the error.

Returns

HtmxErrorResult

MissingHandler(string?)

Creates an error response for an unavailable model handler.

public static HtmxErrorResult MissingHandler(string? componentId = null)

Parameters

componentId string

The optional component id that owns the error.

Returns

HtmxErrorResult

Unauthorized(string?)

Creates an unauthenticated error response.

public static HtmxErrorResult Unauthorized(string? componentId = null)

Parameters

componentId string

The optional component id that owns the error.

Returns

HtmxErrorResult

Validation(string, string?)

Creates a validation error response.

public static HtmxErrorResult Validation(string message, string? componentId = null)

Parameters

message string

The user-safe validation message.

componentId string

The optional component id that owns the error.

Returns

HtmxErrorResult