satellite/payments: log returned error

This makes debugging of issues easier as the error in the web browser
does not show all the info.

Change-Id: Ia79902b7275103a78a21d43ba14243bc32bb8be5
This commit is contained in:
Kaloyan Raev 2020-07-22 12:15:21 +03:00
parent a20e85824a
commit 96c83eb0b8

View File

@ -307,6 +307,12 @@ func (p *Payments) TokenDeposit(w http.ResponseWriter, r *http.Request) {
// serveJSONError writes JSON error to response output stream.
func (p *Payments) serveJSONError(w http.ResponseWriter, status int, err error) {
if status == http.StatusInternalServerError {
p.log.Error("returning error to client", zap.Int("code", status), zap.Error(err))
} else {
p.log.Debug("returning error to client", zap.Int("code", status), zap.Error(err))
}
w.WriteHeader(status)
var response struct {