@@ -29,7 +29,6 @@ const ignoredTags = [
29
29
"HISTORY" ,
30
30
"REF" ,
31
31
"FIGURE" ,
32
-
33
32
] ;
34
33
35
34
const MAXLEN = Number ( process . env . MAX_LEN ) || 3000 ;
@@ -44,7 +43,7 @@ const errorMessages = new Set();
44
43
// Track errors by file for summary reporting
45
44
const fileErrors : Record < string , { message : string ; error ?: any } [ ] > = { } ;
46
45
47
- function logError ( message : string , error ? : any , filePath ? : string ) {
46
+ function logError ( message : string , error : any , filePath : string ) {
48
47
// Create a unique key for this error message
49
48
const errorKey = message + ( error ? error . toString ( ) : "" ) ;
50
49
// Only log if we haven't seen this exact message before
@@ -90,7 +89,7 @@ async function translate(langCode: string, filePath: string): Promise<void> {
90
89
throw new Error ( 'Undefined language' ) ;
91
90
}
92
91
93
- if ( ! troubleshoot ) assistant = await createAssistant ( langCode , language , ai as any ) ;
92
+ if ( ! troubleshoot ) assistant = await createAssistant ( langCode , language , ai ) ;
94
93
95
94
// Generate output path by replacing "/en/" with "/../i18n/translation_output/zh_CN/" in the path
96
95
const output_path = filePath . replace (
@@ -111,9 +110,7 @@ async function translate(langCode: string, filePath: string): Promise<void> {
111
110
fs . writeFileSync ( output_path , translated ) ;
112
111
console . log ( `Translation saved to ${ output_path } ` ) ;
113
112
} catch ( parseErr ) {
114
- logError ( `Error translating file ${ filePath } :` , parseErr , filePath ) ;
115
- // Re-throw the error to propagate it to the caller
116
- throw parseErr ;
113
+ logError ( `Error processing file ${ filePath } :` , parseErr , filePath ) ;
117
114
} finally {
118
115
if ( assistant ) {
119
116
await ai . beta . assistants . del ( assistant . id ) . catch ( err => {
0 commit comments