mongo/jstests/concurrency/worker_thread_test.js
Zac 591928c619 SERVER-108478 JS formatted by prettier and remove clang-format (#39656)
GitOrigin-RevId: 6c8f6aded47f260aa4f7c231b17dae3302cb1e04
2025-08-21 17:27:09 +00:00

22 lines
743 B
JavaScript

import {workerThread} from "jstests/concurrency/fsm_libs/worker_thread.js";
async function shouldForwardErrorsFromAsyncRunCallback(conn) {
const args = {
host: conn.host,
dbName: "test",
tid: "thread0",
clusterOptions: {sharded: false, replication: false},
latch: new CountDownLatch(1),
errorLatch: new CountDownLatch(1),
};
const res = await workerThread.main([], args, async function () {
throw new Error("Thrown intentionally");
});
assert.eq(res.err, "Error: Thrown intentionally", "should forward errors thrown in async run callback");
}
const conn = MongoRunner.runMongod();
await shouldForwardErrorsFromAsyncRunCallback(conn);
MongoRunner.stopMongod(conn);