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

Function getStackString

ses.cjs:7411–7437  ·  view source on GitHub ↗
(error)

Source from the content-addressed store, hash-verified

7409 // string associated with an error.
7410 // See https://tc39.es/proposal-error-stacks/
7411 getStackString(error) {
7412 let stackInfo= weakmapGet(stackInfos, error);
7413
7414 if( stackInfo=== undefined) {
7415 // The following will call `prepareStackTrace()` synchronously
7416 // which will populate stackInfos
7417 // eslint-disable-next-line no-void
7418 void error.stack;
7419 stackInfo= weakmapGet(stackInfos, error);
7420 if( !stackInfo) {
7421 stackInfo= { stackString: ''};
7422 weakmapSet(stackInfos, error, stackInfo);
7423 }
7424 }
7425
7426 // prepareStackTrace() may generate the stackString
7427 // if errorTaming === 'unsafe'
7428
7429 if( stackInfo.stackString!== undefined) {
7430 return stackInfo.stackString;
7431 }
7432
7433 const stackString= stackStringFromSST(error, stackInfo.callSites);
7434 weakmapSet(stackInfos, error, { stackString});
7435
7436 return stackString;
7437 },
7438 prepareStackTrace(error, sst) {
7439 if( errorTaming=== 'unsafe') {
7440 const stackString= stackStringFromSST(error, sst);

Callers 1

logErrorFunction · 0.85

Calls 2

stackStringFromSSTFunction · 0.85
applyFunction · 0.85

Tested by

no test coverage detected