Closed BrianFFish closed 1 year ago
Thanks @BrianFFish for opening this PR. I also started working on this issue yesterday but I needed to ensure the tests pass as well. Let's collaborate on this PR! I will mark it as draft, push my own edits, fix the rest of the tests, and then we can review and merge.
On second thought, I will fix the tests in a separate PR to keep things more tidy.
Thanks for the fix. I just wanted to mention that pc_sect()
is vectorized, so you don't need a for-loop to run it on multiple compounds—just if you want to get data from multiple "sections"
Brief description of the PR
Fix for #354. @stitam and @sxthimons confirmed that the cause of pc_sect() sometimes failing with certain CIDs was that certain PubChem records would return NA by httr::content(), and NA as the txt argument in jsonlite::fromJSON() results in an error that halts code execution. Since pc_sect() is a function likely to be run in a loop, it seems better if pc_sect() fails silently on NA returned from httr::content() and continues instead of breaking the loop with an opaque error.
PR task list:
devtools::document()