goldingn / versions

Query and Install Specific Versions of Packages on CRAN
Other
24 stars 7 forks source link

Small bugfix to prevent available.versions crashing early #22

Open hughjonesd opened 6 years ago

hughjonesd commented 6 years ago

when a version is not recognized.

goldingn commented 6 years ago

Hi David,

Could you please add an issue showing where this causes you an error, so I replicate it?

I can see why that line of code would error if a single row dataframe is returned with NA in the available column, just not what would lead to the NA.

Nick

hughjonesd commented 6 years ago

The one row dataframe is returned from current_version if version is not recognized. Maybe that's fine and you want to throw an error, but it would be nice to have a more comprehensible one; and your warning suggests you want to recover from a single bad version.

> versions::available.versions(c("bad", "testthat"))
Error in if (!all(df$available)) { : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
In current.version(pkgs) :
  The current version and publication date of bad could not
                     be detected
goldingn commented 6 years ago

Gotcha, yep that needs a better error!

hughjonesd commented 6 years ago

OK, this tries to throw an error earlier. The alternative would be to do it in current_version.