fix: error

This commit is contained in:
手瓜一十雪
2025-03-21 20:43:41 +08:00
parent f8e92f7c8d
commit aaefa2e83c

View File

@@ -5,6 +5,9 @@ export async function runTask<T, R>(workerScript: string, taskData: T): Promise<
try {
return await new Promise<R>((resolve, reject) => {
worker.on('message', (result: R) => {
if ((result as any)?.error) {
reject(new Error((result as { error: string }).error));
}
resolve(result);
});