Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/MultithreadedJSBook/code-samples
/ bad
Function
bad
ch2-patterns/worker.js:21–24 ·
view source on GitHub ↗
()
Source
from the content-addressed store, hash-verified
19
return
String(next);
// <4>
20
},
21
async
bad() {
22
await
sleep(Math.random() * 10);
23
throw
new
Error(
'oh no'
);
24
}
25
};
26
27
self.onmessage = asyncOnMessageWrap(
async
(rpc) => {
// <5>
Callers
nothing calls this directly
Calls
1
sleep
Function · 0.85
Tested by
no test coverage detected