Skip to content

Commit 262dc66

Browse files
committed
fix: add error handling for translation service in file function
1 parent 7fac13d commit 262dc66

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/server.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,17 @@ module.exports = async function file(
291291
Array.isArray(directory.languages) &&
292292
!object.translations
293293
) {
294-
// Call your AI translation service
295-
const translations = await options.translate(
296-
source,
297-
directory.languages
298-
);
299-
newObject.object.translations = translations;
294+
try {
295+
// Call your AI translation service
296+
const translations = await options.translate(
297+
source,
298+
directory.languages
299+
);
300+
newObject.object.translations = translations;
301+
} catch (err) {
302+
console.error("Translation error:", err);
303+
// Continue without translations
304+
}
300305
}
301306

302307
if (directory.storage) newObject.storage = directory.storage;

0 commit comments

Comments
 (0)