MCPcopy Create free account
hub / github.com/AI45Lab/Code / withTimeout

Function withTimeout

sdk/node/examples/basic/test_real_config_env_sdk.mjs:34–42  ·  view source on GitHub ↗
(promise, name)

Source from the content-addressed store, hash-verified

32}
33
34function withTimeout(promise, name) {
35 let timer;
36 const timeout = new Promise((_, reject) => {
37 timer = setTimeout(() => {
38 reject(new Error(`${name} timed out after ${timeoutMs}ms`));
39 }, timeoutMs);
40 });
41 return Promise.race([promise, timeout]).finally(() => clearTimeout(timer));
42}
43
44const configFile = process.env.A3S_CONFIG_FILE;
45if (!configFile) {

Callers 1

stepFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected