diff downloader_bank_hmdb.pl @ 2:be504ccbc41c draft default tip

master branch Updating with tag :CI_COMMIT_TAG - - Fxx
author fgiacomoni
date Wed, 30 Nov 2022 16:14:27 +0000
parents 7c9269bded0e
children
line wrap: on
line diff
--- a/downloader_bank_hmdb.pl	Tue Jan 21 16:09:45 2020 -0500
+++ b/downloader_bank_hmdb.pl	Wed Nov 30 16:14:27 2022 +0000
@@ -71,6 +71,7 @@
 		$bankUrl = $CONF->{$bankName.'_URL'}  ;
 		# get version of the http resource
 		my $oUtils = utils->new() ;
+		$oUtils->checkHttpUrl($bankUrl) ;
     	($bankVersion) = $oUtils->getHttpFileVersion($bankUrl) ;
     	
     	print "\tThe current version is: $bankVersion\n" if $VERBOSE > 1 ;	
@@ -132,7 +133,15 @@
 			print "\tDownload of the asked bank ($bankName)...\n" if $VERBOSE > 1 ;
 			print "\tFrom...$bankUrl\n" if $VERBOSE > 1 ;
 			my $oDownloader = utils->new() ;
-			my ($fileZip) = $oDownloader->getHttpFile($bankUrl, $bankFilePath) ;
+			my ($httpStatus) = $oDownloader->getHttpFile($bankUrl, $bankFilePath) ;
+			
+			if ($httpStatus ne '200 OK' ) {
+				unlink $bankFileDir ;
+				croak "\t/!\\ Download of $bankUrl failed with HTTP error: $httpStatus\n" ;
+			}
+			else {
+				print "\tDownloading process ended with HTTP: $httpStatus\n" ;
+			}
 			
 			print "\tUnzip the download archive ($bankFilePath) and clean env ...\n" if $VERBOSE > 1 ;