(code: string)
| 7 | * 3. Errors propagate correctly |
| 8 | */ |
| 9 | export function wrapCode(code: string): string { |
| 10 | // Results must be serialized to JSON because objects can't be transferred |
| 11 | // directly across the isolate boundary in isolated-vm |
| 12 | return ` |
| 13 | (async function() { |
| 14 | try { |
| 15 | const __userResult = await (async function() { |
| 16 | ${code} |
| 17 | })(); |
| 18 | return JSON.stringify(__userResult); |
| 19 | } catch (__error) { |
| 20 | throw __error; |
| 21 | } |
| 22 | })() |
| 23 | ` |
| 24 | } |
no outgoing calls
no test coverage detected