forked from toolshed/coop-cloud-backend
20 lines
505 B
Go
20 lines
505 B
Go
package cli
|
|
import (
|
|
"net/http"
|
|
"log"
|
|
)
|
|
func OnError(err error) {
|
|
// handle errors that continue
|
|
log.Printf("Error: %v", err)
|
|
}
|
|
func InternalServerError(w http.ResponseWriter, err error) {
|
|
log.Printf("Error: %v", err)
|
|
http.Error(w, "internal server error", http.StatusInternalServerError)
|
|
}
|
|
|
|
func NotFound(w http.ResponseWriter, err error) {
|
|
http.Error(w, "not found", http.StatusNotFound)
|
|
}
|
|
func BadRequest(w http.ResponseWriter, err error) {
|
|
http.Error(w, "bad request", http.StatusBadRequest)
|
|
} |