MCPcopy Create free account
hub / github.com/Noumena-Network/code / safeSpawn

Function safeSpawn

src/bridge/bridgeMain.ts:133–145  ·  view source on GitHub ↗

Attempt to spawn a session; returns error string if spawn throws.

(
  spawner: SessionSpawner,
  opts: SessionSpawnOpts,
  dir: string,
)

Source from the content-addressed store, hash-verified

131
132/** Attempt to spawn a session; returns error string if spawn throws. */
133function safeSpawn(
134 spawner: SessionSpawner,
135 opts: SessionSpawnOpts,
136 dir: string,
137): SessionHandle | string {
138 try {
139 return spawner.spawn(opts, dir)
140 } catch (err) {
141 const errMsg = errorMessage(err)
142 logError(new Error(`Session spawn failed: ${errMsg}`))
143 return errMsg
144 }
145}
146
147export async function runBridgeLoop(
148 config: BridgeConfig,

Callers 1

runBridgeLoopFunction · 0.85

Calls 3

logErrorFunction · 0.70
errorMessageFunction · 0.50
spawnMethod · 0.45

Tested by

no test coverage detected