@@ -378,8 +378,6 @@ class IndexifyClient {
378
378
const isNodeEnv = typeof window === "undefined" ;
379
379
const extractionGraphNamesArray = Array . isArray ( extractionGraphNames ) ? extractionGraphNames : [ extractionGraphNames ] ;
380
380
381
- let contentId : string | undefined ;
382
-
383
381
for ( const extractionGraph of extractionGraphNamesArray ) {
384
382
let formData : any ;
385
383
@@ -401,27 +399,34 @@ class IndexifyClient {
401
399
formData . append ( "file" , fileInput ) ;
402
400
}
403
401
404
- const response = await this . client . post (
405
- `/extraction_graphs/${ extractionGraph } /extract` ,
406
- formData ,
407
- {
408
- params : { id : newContentId } ,
409
- headers : {
410
- "Content-Type" : "multipart/form-data" ,
411
- "accept" : "*/*"
402
+ try {
403
+ const response = await this . client . post (
404
+ `/namespaces/default/extraction_graphs/${ extractionGraph } /extract` ,
405
+ formData ,
406
+ {
407
+ params : newContentId ? { id : newContentId } : undefined ,
408
+ headers : {
409
+ "Content-Type" : "multipart/form-data" ,
410
+ "accept" : "*/*"
411
+ }
412
412
}
413
- }
414
- ) ;
413
+ ) ;
415
414
416
- contentId = response . data . content_id || newContentId ;
415
+ const contentId = response . data . content_id ;
417
416
418
- if ( contentId ) {
419
- return contentId ;
417
+ if ( contentId ) {
418
+ console . log ( `Content ID retrieved: ${ contentId } ` ) ;
419
+ return contentId ;
420
+ } else {
421
+ console . warn ( `Unexpected: No content ID found in response for extraction graph: ${ extractionGraph } ` ) ;
422
+ }
423
+ } catch ( error ) {
424
+ console . error ( `Error during extraction for graph ${ extractionGraph } :` , error ) ;
420
425
}
421
-
422
426
}
423
-
424
- throw new Error ( "No content ID was retrieved from the extraction process" ) ;
427
+
428
+ console . error ( `Failed to retrieve content ID for all extraction graphs: ${ extractionGraphNamesArray . join ( ", " ) } ` ) ;
429
+ return "" ;
425
430
}
426
431
427
432
async getExtractionGraphs ( ) : Promise < ExtractionGraph [ ] > {
0 commit comments