s3manager-web/handle-http-error.go
2017-04-03 14:08:01 +02:00

16 lines
288 B
Go

package main
import (
"log"
"net/http"
)
// handleHTTPError handles HTTP errors
func handleHTTPError(w http.ResponseWriter, msg string, err error, statusCode int) {
http.Error(w, msg, statusCode)
if err != nil {
log.Println(msg+":", err.Error())
} else {
log.Println(msg)
}
}