@@ -5,6 +5,7 @@ import { cleanAIJsonResponse } from '../../ai-core/tools/query-validators.js';
55import { QueryOrderingEnum } from '../../enums/query-ordering.enum.js' ;
66import { WidgetTypeEnum } from '../../enums/widget-type.enum.js' ;
77import { checkFieldAutoincrement } from '../../helpers/check-field-autoincrement.js' ;
8+ import { getErrorMessage } from '../../helpers/get-error-message.js' ;
89import { TableSettingsEntity } from '../table-settings/common-table-settings/table-settings.entity.js' ;
910import { TableWidgetEntity } from '../widget/table-widget.entity.js' ;
1011import { TableInformation } from './ai-data-entities/types/ai-module-types.js' ;
@@ -78,13 +79,13 @@ export class AiService {
7879 const batchSettings = await this . processTablesBatch ( batch ) ;
7980 allSettings . push ( ...batchSettings ) ;
8081 } catch ( error ) {
81- console . warn ( `Batch processing failed, falling back to individual table processing: ${ error . message } ` ) ;
82+ console . warn ( `Batch processing failed, falling back to individual table processing: ${ getErrorMessage ( error ) } ` ) ;
8283 for ( const tableInfo of batch ) {
8384 try {
8485 const singleTableSettings = await this . processTablesBatch ( [ tableInfo ] ) ;
8586 allSettings . push ( ...singleTableSettings ) ;
8687 } catch ( singleError ) {
87- console . error ( `Error processing AI for table "${ tableInfo . table_name } ": ${ singleError . message } ` ) ;
88+ console . error ( `Error processing AI for table "${ tableInfo . table_name } ": ${ getErrorMessage ( singleError ) } ` ) ;
8889 }
8990 }
9091 }
@@ -289,7 +290,7 @@ IMPORTANT:
289290 try {
290291 return JSON . parse ( cleanedResponse ) as AIResponse ;
291292 } catch ( error ) {
292- throw new Error ( `Failed to parse AI response for tables [${ tableNames . join ( ', ' ) } ]: ${ error . message } ` ) ;
293+ throw new Error ( `Failed to parse AI response for tables [${ tableNames . join ( ', ' ) } ]: ${ getErrorMessage ( error ) } ` ) ;
293294 }
294295 }
295296
0 commit comments