s3manager-web/web/errors.go
2017-03-30 22:48:27 +02:00

16 lines
287 B
Go

package web
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)
}
}