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
statusCodeintThe HTTP status code for the response.
errorHtmxErrorFragmentThe 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
messagestringThe user-safe operation message.
componentIdstringThe optional component id that owns the error.
Returns
Forbidden(string?)
Creates a forbidden error response.
public static HtmxErrorResult Forbidden(string? componentId = null)
Parameters
componentIdstringThe optional component id that owns the error.
Returns
InternalServerError(string?)
Creates an internal server error response.
public static HtmxErrorResult InternalServerError(string? componentId = null)
Parameters
componentIdstringThe optional component id that owns the error.
Returns
MissingHandler(string?)
Creates an error response for an unavailable model handler.
public static HtmxErrorResult MissingHandler(string? componentId = null)
Parameters
componentIdstringThe optional component id that owns the error.
Returns
Unauthorized(string?)
Creates an unauthenticated error response.
public static HtmxErrorResult Unauthorized(string? componentId = null)
Parameters
componentIdstringThe optional component id that owns the error.
Returns
Validation(string, string?)
Creates a validation error response.
public static HtmxErrorResult Validation(string message, string? componentId = null)
Parameters
messagestringThe user-safe validation message.
componentIdstringThe optional component id that owns the error.