feat: Start implementation of Afero-based filesystem abstraction

This commit is contained in:
Felicitas Pojtinger
2021-12-17 16:59:40 +01:00
parent 59d65169ff
commit b2cbad8ee6
3 changed files with 170 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
package handlers
import (
"fmt"
"log"
"net/http"
"runtime/debug"
)
func PanicHandler(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
defer func() {
if r := recover(); r != nil {
http.Error(w, fmt.Sprintf("%v", r), http.StatusInternalServerError)
log.Println("Error:", r, "\nStack:", string(debug.Stack()))
}
}()
h.ServeHTTP(w, r)
})
}