2024-05-16 17:59:21 +02:00
|
|
|
package handlers
|
2024-02-14 00:08:14 +01:00
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
|
2024-03-13 15:54:09 +01:00
|
|
|
func InternalServerErrorHandler(w http.ResponseWriter) {
|
2024-02-14 00:08:14 +01:00
|
|
|
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) {
|
2024-02-14 00:08:14 +01:00
|
|
|
w.WriteHeader(http.StatusNotFound)
|
|
|
|
|
_, err := w.Write([]byte("404 Not Found"))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-02-15 15:21:59 +01:00
|
|
|
|
2024-03-13 15:54:09 +01:00
|
|
|
func BadRequestHandler(w http.ResponseWriter) {
|
2024-02-15 15:21:59 +01:00
|
|
|
w.WriteHeader(http.StatusBadRequest)
|
|
|
|
|
_, err := w.Write([]byte("400 Bad Request"))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|