From 7b6796e2c123646e36b60834e0770c0a6a27e567 Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L de Mello" Date: Wed, 5 Mar 2025 12:22:38 -0300 Subject: [PATCH] feat: panic recovering on requests --- router/router.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/router/router.go b/router/router.go index c583016..9841ee0 100644 --- a/router/router.go +++ b/router/router.go @@ -21,6 +21,7 @@ func New(assertions tinyssert.Assertions, log *slog.Logger, dev bool) http.Handl } else { r.Use(middleware.PersistentCache()) } + r.Use(exceptions.PanicMiddleware()) r.Use(exceptions.Middleware()) r.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) { @@ -32,6 +33,9 @@ func New(assertions tinyssert.Assertions, log *slog.Logger, dev bool) http.Handl exceptions.WithData("test-data", "test-value"), ).ServeHTTP(w, r) }) + r.HandleFunc("/panic", func(w http.ResponseWriter, r *http.Request) { + panic("TEST PANIC") + }) return r }