March Docs

ErrorView

Bastion.ErrorView — default HTML error page rendering.

Renders user-friendly error pages for common HTTP status codes. Used by FallbackController and the router's default 404 handler.

Example:

let html = ErrorView.render(404, "The page you were looking for does not exist.")
Response.html(conn, 404, html)

Functions

fndefault_messagedefault_message(status : Int) : String#

Return a default user-facing message for a given status code.

fnrenderrender(status : Int, message : String) : String#

Render an HTML error page for the given HTTP status code and message.

Returns a complete HTML document string with inline styling.  The message
argument is HTML-escaped before being inserted into the page so that
user-controlled content cannot inject markup or scripts.

Example:
  ErrorView.render(404, "Not Found")
fnrender_defaultrender_default(status : Int) : String#

Render a minimal error page using a default message for the given status code.

Example:
  ErrorView.render_default(500)
fnstatus_textstatus_text(status : Int) : String#

Return the standard HTTP status text for a given status code.

Example:
  ErrorView.status_text(404)  -- => "Not Found"