Skip to content

Commit f0316dc

Browse files
author
yihao03
committed
Fix error handling in recursivelyTranslate function and remove debug log
1 parent 29f1441 commit f0316dc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

i18n/controllers/recurTranslate.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ async function recursivelyTranslate(
296296
const text = messageContent.text;
297297

298298
const safeText = escapeXML(text.value);
299-
console.log(safeText);
300299
const textStream = Readable.from("<WRAPPER>" + safeText + "</WRAPPER>");
301300

302301
await new Promise<void>((resolve, reject) => {
@@ -348,7 +347,7 @@ async function recursivelyTranslate(
348347
clean._parser.resume();
349348
} catch (e) {
350349
console.log("Failed to resume parser:", e);
351-
reject;
350+
reject();
352351
}
353352
});
354353

@@ -360,7 +359,7 @@ async function recursivelyTranslate(
360359
return translatedChunk;
361360
} catch (err) {
362361
console.log(`Error occured while translating ${path}:\n ` + err);
363-
return translated + "<!-- Error translating this section -->";
362+
return translatedChunk + "<!-- Error translating this section -->";
364363
}
365364
}
366365
}

0 commit comments

Comments
 (0)