onedrive: graph: Remove unnecessary error checks

This commit is contained in:
Cnly 2018-08-21 10:55:35 +08:00
parent 5f3f9b8a16
commit b874bc22ec
1 changed files with 3 additions and 12 deletions

View File

@ -139,13 +139,10 @@ func init() {
}
sites := siteResponse{}
resp, err := srv.CallJSON(&opts, nil, &sites)
_, err := srv.CallJSON(&opts, nil, &sites)
if err != nil {
log.Fatalf("Failed to query available sites: %v", err)
}
if resp.StatusCode != 200 {
log.Fatalf("Failed to query available sites: Got HTTP error code %d", resp.StatusCode)
}
if len(sites.Sites) == 0 {
log.Fatalf("Search for '%s' returned no results", searchTerm)
@ -171,13 +168,10 @@ func init() {
// query Microsoft Graph
if finalDriveID == "" {
drives := drivesResponse{}
resp, err := srv.CallJSON(&opts, nil, &drives)
_, err := srv.CallJSON(&opts, nil, &drives)
if err != nil {
log.Fatalf("Failed to query available drives: %v", err)
}
if resp.StatusCode != 200 {
log.Fatalf("Failed to query available drives: Got HTTP error code %d", resp.StatusCode)
}
if len(drives.Drives) == 0 {
log.Fatalf("No drives found")
@ -196,13 +190,10 @@ func init() {
RootURL: graphURL,
Path: "/drives/" + finalDriveID + "/root"}
var rootItem api.Item
resp, err := srv.CallJSON(&opts, nil, &rootItem)
_, err = srv.CallJSON(&opts, nil, &rootItem)
if err != nil {
log.Fatalf("Failed to query root for drive %s: %v", finalDriveID, err)
}
if resp.StatusCode != 200 {
log.Fatalf("Failed to query root for drive %s: Got HTTP error code %d", finalDriveID, resp.StatusCode)
}
fmt.Printf("Found drive '%s' of type '%s', URL: %s\nIs that okay?\n", rootItem.Name, rootItem.ParentReference.DriveType, rootItem.WebURL)
// This does not work, YET :)