Francis.ErrorPage (Francis v0.3.1)
View SourceGenerates simple HTML error pages for common HTTP error responses.
Used internally by Francis to render error pages for 404 and 500 responses. Can also be used directly to generate custom error pages.
Examples
Francis.ErrorPage.render(404)
#=> "<!DOCTYPE html>..."
Francis.ErrorPage.render(500)
#=> "<!DOCTYPE html>..."
Francis.ErrorPage.render(503, "Service Unavailable", "We'll be back shortly.")
#=> "<!DOCTYPE html>..."
Summary
Functions
Renders an HTML error page for the given status code.
Renders an HTML error page with a custom title and message.
Functions
Renders an HTML error page for the given status code.
Uses default title and message for known status codes (400, 404, 500, 502, 503). For unknown codes, uses "Error" as the title and a generic message.
Examples
iex> Francis.ErrorPage.render(404) |> String.contains?("Not Found")
true
Renders an HTML error page with a custom title and message.
Examples
iex> Francis.ErrorPage.render(503, "Maintenance", "Back soon!")
iex> |> String.contains?("Maintenance")
true