(cause: Event)
| 358 | } |
| 359 | |
| 360 | function onError(cause: Event) { |
| 361 | const exit = Exit.fail( |
| 362 | new SqlError({ reason: classifyError(cause, "SQLite WASM worker failed", "worker") }) |
| 363 | ) |
| 364 | const requests = Array.from(pending.values()) |
| 365 | pending.clear() |
| 366 | for (const resume of requests) { |
| 367 | resume(exit) |
| 368 | } |
| 369 | Effect.runFork(ScopedRef.set(connectionRef, makeConnection)) |
| 370 | } |
| 371 | if ("onerror" in worker) { |
| 372 | worker.addEventListener("error", onError) |
| 373 | } |