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 {
786786 if ( ! list . Contents ) {
787787 return [ ] ;
788788 } else {
789- const csvFile = await Promise . all (
789+ const csvFiles = await Promise . all (
790790 list . Contents . map ( async ( file ) => {
791791 const command = new GetObjectCommand ( {
792792 Bucket : bucketName ,
@@ -795,7 +795,7 @@ export abstract class BaseDriver implements DriverInterface {
795795 return getSignedUrl ( storage , command , { expiresIn : 3600 } ) ;
796796 } )
797797 ) ;
798- return csvFile ;
798+ return csvFiles ;
799799 }
800800 }
801801
@@ -818,16 +818,17 @@ export abstract class BaseDriver implements DriverInterface {
818818 const bucket = storage . bucket ( bucketName ) ;
819819 const [ files ] = await bucket . getFiles ( { prefix : `${ tableName } /` } ) ;
820820 if ( files . length ) {
821- const csvFile = await Promise . all ( files . map ( async ( file ) => {
821+ const csvFiles = await Promise . all ( files . map ( async ( file ) => {
822822 const [ url ] = await file . getSignedUrl ( {
823823 action : 'read' ,
824824 expires : new Date ( new Date ( ) . getTime ( ) + 60 * 60 * 1000 )
825825 } ) ;
826826 return url ;
827827 } ) ) ;
828- return csvFile ;
828+
829+ return csvFiles ;
829830 } else {
830- return [ ] ;
831+ throw new Error ( 'No CSV files were obtained from the bucket' ) ;
831832 }
832833 }
833834
@@ -923,6 +924,10 @@ export abstract class BaseDriver implements DriverInterface {
923924 }
924925 }
925926
927+ if ( csvFiles . length === 0 ) {
928+ throw new Error ( 'No CSV files were obtained from the bucket' ) ;
929+ }
930+
926931 return csvFiles ;
927932 }
928933}
You can’t perform that action at this time.
0 commit comments