ropensci/targets

Wrong debugging suggestions in debug.

eliocamp opened this issue · 1 comments

When using the debug option for this target:

     , tar_target(son_files, cmip_select_season(files, season = "SON", folder = son_dir),
                  pattern = map(files, files_latest_modified), 
                  format = "file_fast"
                  )

I get this message:

ℹ You are now running an interactive debugger in target son_files_c0ec9533.
  You can enter code and print objects as with the normal R console.
  How to use: https://adv-r.hadley.nz/debugging.html#browser

ℹ The debugger is poised to run the command of target son_files_c0ec9533:

     cmip_select_season(files, season = "SON", folder = son_dir)

ℹ Tip: run debug(cmip_select_season(files, season = "SON", folder = son_dir)) and then enter "c"
  to move the debugger inside function cmip_select_season(files, season = "SON", folder = son_dir)().
  Then debug the function as you would normally (without `targets`).

I think this is wrong. Running debug(cmip_select_season(files, season = "SON", folder = son_dir)) ran the command and then try to debug the result of the function. In my case, the result is a filename and I get:

Error in debug(cmip_select_season(files, season = "SON", folder = son_dir)) : 
  could not find function "/home/elio.campitelli/ceofcmip6/data/derived_data/cmip/SON/tos_Omon_IPSL-CM6A-LR_historical_r26i1p1f1_gn_185001-201412.nc"

I think that the message should say

ℹ Tip: run debug(cmip_select_season) and then enter "c"
  to move the debugger inside function cmip_select_season().

Thanks, 2837739 makes the debugger message more generic and fixes this issue.