@@ -29,7 +29,6 @@ const ignoredTags = [
2929 "HISTORY" ,
3030 "REF" ,
3131 "FIGURE" ,
32-
3332] ;
3433
3534const MAXLEN = Number ( process . env . MAX_LEN ) || 3000 ;
@@ -44,7 +43,7 @@ const errorMessages = new Set();
4443// Track errors by file for summary reporting
4544const fileErrors : Record < string , { message : string ; error ?: any } [ ] > = { } ;
4645
47- function logError ( message : string , error ? : any , filePath ? : string ) {
46+ function logError ( message : string , error : any , filePath : string ) {
4847 // Create a unique key for this error message
4948 const errorKey = message + ( error ? error . toString ( ) : "" ) ;
5049 // Only log if we haven't seen this exact message before
@@ -90,7 +89,7 @@ async function translate(langCode: string, filePath: string): Promise<void> {
9089 throw new Error ( 'Undefined language' ) ;
9190 }
9291
93- if ( ! troubleshoot ) assistant = await createAssistant ( langCode , language , ai as any ) ;
92+ if ( ! troubleshoot ) assistant = await createAssistant ( langCode , language , ai ) ;
9493
9594 // Generate output path by replacing "/en/" with "/../i18n/translation_output/zh_CN/" in the path
9695 const output_path = filePath . replace (
@@ -111,9 +110,7 @@ async function translate(langCode: string, filePath: string): Promise<void> {
111110 fs . writeFileSync ( output_path , translated ) ;
112111 console . log ( `Translation saved to ${ output_path } ` ) ;
113112 } 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 ) ;
117114 } finally {
118115 if ( assistant ) {
119116 await ai . beta . assistants . del ( assistant . id ) . catch ( err => {
0 commit comments