MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / memoizedLoadWithErrorAnnotation

Function memoizedLoadWithErrorAnnotation

ses.cjs:8021–8071  ·  view source on GitHub ↗
(
  compartmentPrivateFields,
  moduleAliases,
  compartment,
  moduleSpecifier,
  pendingJobs,
  moduleLoads,
  errors)

Source from the content-addressed store, hash-verified

8019 };
8020
8021const memoizedLoadWithErrorAnnotation= async(
8022 compartmentPrivateFields,
8023 moduleAliases,
8024 compartment,
8025 moduleSpecifier,
8026 pendingJobs,
8027 moduleLoads,
8028 errors)=>
8029 {
8030 const { name: compartmentName}= weakmapGet(
8031 compartmentPrivateFields,
8032 compartment);
8033
8034
8035 // Prevent data-lock from recursion into branches visited in dependent loads.
8036 let compartmentLoading= mapGet(moduleLoads, compartment);
8037 if( compartmentLoading=== undefined) {
8038 compartmentLoading= new Map();
8039 mapSet(moduleLoads, compartment, compartmentLoading);
8040 }
8041 let moduleLoading= mapGet(compartmentLoading, moduleSpecifier);
8042 if( moduleLoading!== undefined) {
8043 return moduleLoading;
8044 }
8045
8046 moduleLoading= promiseCatch(
8047 loadWithoutErrorAnnotation(
8048 compartmentPrivateFields,
8049 moduleAliases,
8050 compartment,
8051 moduleSpecifier,
8052 pendingJobs,
8053 moduleLoads,
8054 errors),
8055
8056 (error)=>{
8057 // eslint-disable-next-line @endo/no-polymorphic-call
8058 assert.note(
8059 error,
8060 d `${error.message}, loading ${q(moduleSpecifier)} in compartment ${q(
8061 compartmentName)
8062 }`);
8063
8064 throw error;
8065 });
8066
8067
8068 mapSet(compartmentLoading, moduleSpecifier, moduleLoading);
8069
8070 return moduleLoading;
8071 };
8072
8073/*
8074 * `load` asynchronously gathers the `StaticModuleRecord`s for a module and its

Callers 3

loadRecordFunction · 0.85
loadFunction · 0.85

Calls 1

Tested by

no test coverage detected