From fb9a95e68e1258158bb64896d9b398d4b313c3d8 Mon Sep 17 00:00:00 2001 From: Cnly Date: Tue, 21 Aug 2018 10:55:35 +0800 Subject: [PATCH] onedrive: graph: Remove unnecessary error checks --- backend/onedrive/onedrive.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.go index 2c3905d55..3bc99bb93 100644 --- a/backend/onedrive/onedrive.go +++ b/backend/onedrive/onedrive.go @@ -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 :)