Merge pull request #235 from mrd0ll4r/http-log-internal-errors
http: log internal server errors
This commit is contained in:
commit
71232b3fad
1 changed files with 4 additions and 0 deletions
|
@ -3,6 +3,8 @@ package http
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
|
||||
"github.com/chihaya/chihaya/bittorrent"
|
||||
"github.com/chihaya/chihaya/frontend/http/bencode"
|
||||
)
|
||||
|
@ -12,6 +14,8 @@ func WriteError(w http.ResponseWriter, err error) error {
|
|||
message := "internal server error"
|
||||
if _, clientErr := err.(bittorrent.ClientError); clientErr {
|
||||
message = err.Error()
|
||||
} else {
|
||||
log.Errorf("http: internal error: %s", err)
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
|
Loading…
Reference in a new issue