s3manager-web/handle-http-error.go

17 lines
288 B
Go
Raw Normal View History

2017-04-03 14:08:01 +02:00
package main
2017-03-30 14:00:06 +02:00
import (
"log"
"net/http"
)
2017-04-03 14:08:01 +02:00
// handleHTTPError handles HTTP errors
func handleHTTPError(w http.ResponseWriter, msg string, err error, statusCode int) {
2017-03-30 14:00:06 +02:00
http.Error(w, msg, statusCode)
if err != nil {
log.Println(msg+":", err.Error())
} else {
log.Println(msg)
}
}