rstudio / rstudioapi

Safely access RStudio's API (when available)
http://rstudio.github.io/rstudioapi
Other
165 stars 35 forks source link

Suggestion: A more informative error message for jobAdd("", progressUnits = 10) #212

Open HenrikBengtsson opened 3 years ago

HenrikBengtsson commented 3 years ago

The error message when passing a double rather than an integer progressUnits value took me down a 5-10 minutes troubleshooting and interactive debugging session until I realized that progressUnits strictly needs to be an as.integer() value;

> id <- rstudioapi::jobAdd("", progressUnits = 10L)
> id <- rstudioapi::jobAdd("", progressUnits = 10)
Error in (function (name, status = "", progressUnits = 0L, actions = NULL,  : 
  progressUnits must be an integer between 1 and 1000000, or 0 to disable progress.

The error message is clear, when you understand it but only then. May I suggest that it in this case reports on:

  progressUnits must be of type integer.