@@ -401,6 +401,9 @@ export class GPTScript {
401
401
const r : Run = new RunSubcommand ( "datasets" , "" , { URL : this . opts . URL , Token : this . opts . Token } )
402
402
r . request ( { input : "{}" , workspace : workspace , datasetToolRepo : this . opts . DatasetToolRepo ?? "" } )
403
403
const result = await r . text ( )
404
+ if ( result . startsWith ( "ERROR:" ) ) {
405
+ throw new Error ( result )
406
+ }
404
407
return JSON . parse ( result ) as Array < DatasetMeta >
405
408
}
406
409
@@ -416,6 +419,9 @@ export class GPTScript {
416
419
datasetToolRepo : this . opts . DatasetToolRepo ?? ""
417
420
} )
418
421
const result = await r . text ( )
422
+ if ( result . startsWith ( "ERROR:" ) ) {
423
+ throw new Error ( result )
424
+ }
419
425
return JSON . parse ( result ) as Dataset
420
426
}
421
427
@@ -436,6 +442,9 @@ export class GPTScript {
436
442
datasetToolRepo : this . opts . DatasetToolRepo ?? ""
437
443
} )
438
444
const result = await r . text ( )
445
+ if ( result . startsWith ( "ERROR:" ) ) {
446
+ throw new Error ( result )
447
+ }
439
448
return JSON . parse ( result ) as DatasetElementMeta
440
449
}
441
450
@@ -451,6 +460,9 @@ export class GPTScript {
451
460
datasetToolRepo : this . opts . DatasetToolRepo ?? ""
452
461
} )
453
462
const result = await r . text ( )
463
+ if ( result . startsWith ( "ERROR:" ) ) {
464
+ throw new Error ( result )
465
+ }
454
466
return JSON . parse ( result ) as Array < DatasetElementMeta >
455
467
}
456
468
@@ -466,6 +478,9 @@ export class GPTScript {
466
478
datasetToolRepo : this . opts . DatasetToolRepo ?? ""
467
479
} )
468
480
const result = await r . text ( )
481
+ if ( result . startsWith ( "ERROR:" ) ) {
482
+ throw new Error ( result )
483
+ }
469
484
return JSON . parse ( result ) as DatasetElement
470
485
}
471
486
0 commit comments