File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
packages/cubejs-base-driver/src Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -786,7 +786,7 @@ export abstract class BaseDriver implements DriverInterface {
786
786
if ( ! list . Contents ) {
787
787
return [ ] ;
788
788
} else {
789
- const csvFile = await Promise . all (
789
+ const csvFiles = await Promise . all (
790
790
list . Contents . map ( async ( file ) => {
791
791
const command = new GetObjectCommand ( {
792
792
Bucket : bucketName ,
@@ -795,7 +795,7 @@ export abstract class BaseDriver implements DriverInterface {
795
795
return getSignedUrl ( storage , command , { expiresIn : 3600 } ) ;
796
796
} )
797
797
) ;
798
- return csvFile ;
798
+ return csvFiles ;
799
799
}
800
800
}
801
801
@@ -818,16 +818,17 @@ export abstract class BaseDriver implements DriverInterface {
818
818
const bucket = storage . bucket ( bucketName ) ;
819
819
const [ files ] = await bucket . getFiles ( { prefix : `${ tableName } /` } ) ;
820
820
if ( files . length ) {
821
- const csvFile = await Promise . all ( files . map ( async ( file ) => {
821
+ const csvFiles = await Promise . all ( files . map ( async ( file ) => {
822
822
const [ url ] = await file . getSignedUrl ( {
823
823
action : 'read' ,
824
824
expires : new Date ( new Date ( ) . getTime ( ) + 60 * 60 * 1000 )
825
825
} ) ;
826
826
return url ;
827
827
} ) ) ;
828
- return csvFile ;
828
+
829
+ return csvFiles ;
829
830
} else {
830
- return [ ] ;
831
+ throw new Error ( 'No CSV files were obtained from the bucket' ) ;
831
832
}
832
833
}
833
834
@@ -923,6 +924,10 @@ export abstract class BaseDriver implements DriverInterface {
923
924
}
924
925
}
925
926
927
+ if ( csvFiles . length === 0 ) {
928
+ throw new Error ( 'No CSV files were obtained from the bucket' ) ;
929
+ }
930
+
926
931
return csvFiles ;
927
932
}
928
933
}
You can’t perform that action at this time.
0 commit comments