Skip to content

Can we make '"not all 'rnames' found or unique."' more specific, perhaps softer error? #60

Open

Description

@vjcitn

The event was noted in build attempts for OSCA.intro. There is a unit test in BiocFileCache, so we can explore approaches to enhancing the user experience. Comments will provide more info.

Activity

  1. lshep commented on Mar 25, 2025

    @lshep
    Contributor

    I don't agree with a soft error and guessing at what the user wants. I do agree we could separate out these conditions and provide more helpful comments/messages to assist the end user with how to proceed.

    In the OSCA.intro they also use a helper function to add if a url is not found and return the local path in one step; I really never liked this helper function but it exists but should be used with caution. It could likely also be smoothed out if they did the longer query to see if it exists and then the user decide if they need to add or what resource path to grab which would also likely provide more information in each of these steps.

  2. lshep commented on May 13, 2025

    @lshep
    Contributor

    It seems like if you actually run this manually you can already tell what the issue is (not found or not unique) in the warnings messages that are produced as depending on if the function is trying to return values or trying to add values it ends up in different calls...so those soft fail with a warning to later fail with the hard error (as it either wasn't downloaded so can't return the path, or matched multiple and did know which to return [and the warning message gives suggestions on how to remedy already])

    not unique

    > bfcrpath(bfc, "rname1")
    Error in bfcrpath(bfc, "rname1") : not all 'rnames' found or unique.
    In addition: Warning message:
    In FUN(X[[i]], ...) : 'rnames' exact pattern
        'rname1'
      is not unique; use 'bfcquery()' to see matches.
    
    

    not found

    > bfcrpath(bfc, rname="rname2", fpath="https://httpbin.org/status/404")
    adding rname 'rname2'
    Error in bfcrpath(bfc, rname = "rname2", fpath = "https://httpbin.org/status/404") : 
      not all 'rnames' found or unique.
    In addition: Warning messages:
    1: download failed
      web resource path: 'https://httpbin.org/status/404'
      local file path: '/home/lorikern/.cache/R/BiocFileCache/d57630f16d81_404'
      reason: HTTP 404 Not Found. 
    2: bfcadd() failed; resource removed
      rid: BFC4
      fpath: 'https://httpbin.org/status/404'
      reason: download failed 
    3: In value[[3L]](cond) : 
    trying to add rname 'rname2' produced error:
      bfcadd() failed; see warnings()
    
  3. lshep commented on May 13, 2025

    @lshep
    Contributor

    Another solution is to do the check if the id exists and then choose addition or just return path using the individual steps rather than use this "helper" function that tries to be smart which seems to obscure failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions