mirror of
https://github.com/rclone/rclone.git
synced 2025-01-26 16:20:23 +01:00
onedrive: graph: Remove unnecessary error checks
This commit is contained in:
parent
85e0839c8b
commit
fb9a95e68e
@ -139,13 +139,10 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sites := siteResponse{}
|
sites := siteResponse{}
|
||||||
resp, err := srv.CallJSON(&opts, nil, &sites)
|
_, err := srv.CallJSON(&opts, nil, &sites)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to query available sites: %v", err)
|
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 {
|
if len(sites.Sites) == 0 {
|
||||||
log.Fatalf("Search for '%s' returned no results", searchTerm)
|
log.Fatalf("Search for '%s' returned no results", searchTerm)
|
||||||
@ -171,13 +168,10 @@ func init() {
|
|||||||
// query Microsoft Graph
|
// query Microsoft Graph
|
||||||
if finalDriveID == "" {
|
if finalDriveID == "" {
|
||||||
drives := drivesResponse{}
|
drives := drivesResponse{}
|
||||||
resp, err := srv.CallJSON(&opts, nil, &drives)
|
_, err := srv.CallJSON(&opts, nil, &drives)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to query available drives: %v", err)
|
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 {
|
if len(drives.Drives) == 0 {
|
||||||
log.Fatalf("No drives found")
|
log.Fatalf("No drives found")
|
||||||
@ -196,13 +190,10 @@ func init() {
|
|||||||
RootURL: graphURL,
|
RootURL: graphURL,
|
||||||
Path: "/drives/" + finalDriveID + "/root"}
|
Path: "/drives/" + finalDriveID + "/root"}
|
||||||
var rootItem api.Item
|
var rootItem api.Item
|
||||||
resp, err := srv.CallJSON(&opts, nil, &rootItem)
|
_, err = srv.CallJSON(&opts, nil, &rootItem)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to query root for drive %s: %v", finalDriveID, err)
|
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)
|
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 :)
|
// This does not work, YET :)
|
||||||
|
Loading…
Reference in New Issue
Block a user