googledrive icon indicating copy to clipboard operation
googledrive copied to clipboard

Expand upon "Download failed"?

Open sigven opened this issue 3 years ago • 6 comments

Hi,

Thanks for a very useful package. For reasons I do not fully understand, I experience from time to time download errors when using googledrive to download data from some of my R packages, i.e.

Error in googledrive::drive_download(): ! Download failed.

I suspect it has to do with some download limitations by the Google Drive API, but I am not sure.

Would it be possible to utilize more information regarding the request made, so that the user is somewhat better informed regarding the reason for why the download in fact failed?

kind regards, Sigve

sigven avatar Oct 04 '22 21:10 sigven

To work on this, it's very helpful to have a reliable way to experience the problem (the one leading to Download failed). Do you happen to have such a thing? Error handling with these APIs is notoriously hard because it can be hard to get a good example of failure to code against.

jennybc avatar Oct 04 '22 22:10 jennybc

Totally understand. I basically encounter it now and then, and this is why I find it confusing and wanted to figure out why it sometimes fails. But if this is related to some (to me unclear) restrictions that Google imposes on the user download access frequency (?), I guess it's challenging to find a reliable example that I know will fail.

A user of my package just reported an issue where he experienced a download fail, but I have successfully called the same function (oncoEnrichR::load_db()) tonight, so I am fairly unsure.

sigven avatar Oct 04 '22 22:10 sigven

I can create a branch that actually processes the response in the error case. And then, if you install googledrive from that branch, next time you experience such a failure, you should be able to retrieve the last error from gargle (another package used under the hood). Then you could convey that to me. Do you sometimes see this error yourself?

jennybc avatar Oct 05 '22 00:10 jennybc

Good idea, that sounds like a very helpful strategy. Yes, as I was doing some repeated testing last night, I saw the same error myself.

sigven avatar Oct 05 '22 06:10 sigven

OK if you install googledrive from the (draft) PR or the associated branch, the next time this happens more information may be revealed to you automatically. And you can also call gargle:::gargle_last_response() or gargle:::gargle_last_content() to explicitly get details on the most recent response. Hopefully this will give us more info to decide how to proceed.

devtools::install_github("tidyverse/googledrive#400")
# or
devtools::install_github("tidyverse/googledrive@expose-download-failure")

jennybc avatar Oct 05 '22 15:10 jennybc

Great! Thanks a lot for handling this so quickly.

sigven avatar Oct 06 '22 08:10 sigven