federated-dash/cmd/web/error-handlers.go

17 lines
435 B
Go
Raw Permalink Normal View History

2024-06-25 17:35:30 +00:00
package main
import (
"net/http"
"runtime/debug"
)
func (app *application) serverError(writer http.ResponseWriter, request *http.Request, err error) {
var(
method = request.Method
uri = request.URL.RequestURI()
trace = string(debug.Stack())
)
app.logger.Error(err.Error(), "method", method, "uri", uri, "trace", trace)
http.Error(writer, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
}