Handle internal server error using new custom template
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package errorHandler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/fossyy/filekeeper/logger"
|
||||
@ -17,7 +18,7 @@ func NotFound(w http.ResponseWriter, r *http.Request) {
|
||||
component := errorView.NotFound("Not Found")
|
||||
err := component.Render(r.Context(), w)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
fmt.Fprint(w, err.Error())
|
||||
log.Error(err.Error())
|
||||
return
|
||||
}
|
||||
@ -27,7 +28,7 @@ func InternalServerError(w http.ResponseWriter, r *http.Request) {
|
||||
component := errorView.InternalServerError("Internal Server Error")
|
||||
err := component.Render(r.Context(), w)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
fmt.Fprint(w, err.Error())
|
||||
log.Error(err.Error())
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user