mirror of
https://github.com/sot-tech/mochi.git
synced 2026-06-14 00:23:35 -07:00
Merge pull request #235 from mrd0ll4r/http-log-internal-errors
http: log internal server errors
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user