pico-engine icon indicating copy to clipboard operation
pico-engine copied to clipboard

`wrangler:picoQuery` fails if ECI is for a pico that doesn't have the RID installed

Open b1conrad opened this issue 2 years ago • 1 comments

This is inherited from ctx:query which behaves the same way.

The caller should ensure that this doesn't happen, but there is a workaround that could be put into the function. That is to first query a RID that is known to be installed in every pico, io.picolabs.wrangler/installedRIDs and check the result for containing the original RID. But what to do it it is not there? Pass in a failure function or answer?

b1conrad avatar Jun 08 '22 19:06 b1conrad

Workaround is, for example, this code:

    coreRID = "byu.hr.core"
    wranglerRID = "io.picolabs.wrangler"
        otherDisplayName = function(eci){
          oRIDs = wrangler:picoQuery(eci,wranglerRID,"installedRIDs")
          isParticipant = oRIDs >< coreRID
          isParticipant => wrangler:picoQuery(eci,coreRID,"displayName")
                         | wrangler:picoQuery(eci,wranglerRID,"name")
        }

b1conrad avatar Jun 08 '22 19:06 b1conrad