portfolio/api/handlers/errorHandlers.go

28 lines
550 B
Go
Raw Normal View History

2024-05-16 17:59:21 +02:00
package handlers
import "net/http"
2024-03-13 15:54:09 +01:00
func InternalServerErrorHandler(w http.ResponseWriter) {
w.WriteHeader(http.StatusInternalServerError)
_, err := w.Write([]byte("500 Internal Server Error"))
if err != nil {
return
}
}
2024-03-13 15:54:09 +01:00
func NotFoundHandler(w http.ResponseWriter) {
w.WriteHeader(http.StatusNotFound)
_, err := w.Write([]byte("404 Not Found"))
if err != nil {
return
}
}
2024-03-13 15:54:09 +01:00
func BadRequestHandler(w http.ResponseWriter) {
w.WriteHeader(http.StatusBadRequest)
_, err := w.Write([]byte("400 Bad Request"))
if err != nil {
return
}
}