mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-20 05:30:06 +08:00
fix: error
This commit is contained in:
parent
f8e92f7c8d
commit
aaefa2e83c
@ -5,6 +5,9 @@ export async function runTask<T, R>(workerScript: string, taskData: T): Promise<
|
|||||||
try {
|
try {
|
||||||
return await new Promise<R>((resolve, reject) => {
|
return await new Promise<R>((resolve, reject) => {
|
||||||
worker.on('message', (result: R) => {
|
worker.on('message', (result: R) => {
|
||||||
|
if ((result as any)?.error) {
|
||||||
|
reject(new Error((result as { error: string }).error));
|
||||||
|
}
|
||||||
resolve(result);
|
resolve(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user