Merge pull request #67 from maximbaz/print_vcs_error_details

Print VCS error details
This commit is contained in:
J Guerreiro 2017-11-21 13:41:04 +09:00 committed by GitHub
commit 3913673c8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

7
vcs.go
View file

@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
@ -71,9 +72,11 @@ func (info *Info) needsUpdate() bool {
}
defer r.Body.Close()
err = json.NewDecoder(r.Body).Decode(&newRepo)
body, _ := ioutil.ReadAll(r.Body)
err = json.Unmarshal(body, &newRepo)
if err != nil {
fmt.Println(err)
fmt.Printf("Cannot update '%v'\nError: %v\nStatus code: %v\nBody: %v\n",
info.Package, err, r.StatusCode, string(body))
return false
}