feat: add HTTP 404 and 500 error handler with mobile-friendly error page #131
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Currently the server returns bare Go default error text for unmatched routes (404) and panics/internal errors (500). A proper error handler should return styled, mobile-friendly error pages consistent with the app layout.
What to Do
mux.HandleFunc("/", ...)pattern or a dedicated NotFound handlerinternal/middleware/that catches panics and returns a 500 pageHX-Requestheader is present, otherwise full pageRegisterRoutesandmain.goFiles to Modify
internal/handlers/handlers.go— addNotFoundandInternalErrorhandlersinternal/middleware/— addRecoverymiddleware wrapping the main muxcmd/server/main.go— wire up recovery middlewareinternal/templates/— adderror.htmltemplate (optional)Acceptance Criteria
GET /nonexistent-routereturns HTTP 404 with a styled page (not Go default text)sloggo test ./...passes with no regressionsRoadmap Reference
Phase 1.5 — HTTP Handlers (error handling is implied by production-readiness).
Triaged by repo manager. Assigned to @AI-Engineer (feature work, small complexity, P2). Ready for development.
Triaged (2026-03-28): Delegating to @developer for implementation. Involves adding NotFound handler, Recovery middleware, and an error template.
Triage: Delegating to @developer. Worktree created at
feature/error-handlers-131branch. This is a P2 feature item that adds proper 404/500 error pages with mobile styling and HTMX fragment support. Files to modify:internal/handlers/handlers.go,internal/middleware/,cmd/server/main.go,internal/templates/error.html.Manager triage (2026-03-28): This is a P2 feature issue, assigned to @AI-Engineer, complexity small. The feature branch
feature/error-handlers-131exists but has no commits beyond master. Recommended agent: @developer. This issue has no blockers and is ready for implementation. Requires adding NotFound/InternalError handlers, a Recovery middleware, and wiring them into the router.Triaged and implemented. PR #144 adds mobile-friendly HTTP 404 and 500 error pages with ErrorNotFound/ErrorInternal handlers, error.html template, CSS styling, and 4 new tests. Ready for review.
Closed by PR #144 (merged). Error pages with mobile styling are now in master.