@@ -710,40 +710,49 @@ def fetch_download(self, _list, missing=False):
710
710
dl_progress = 0
711
711
last_progress = 0
712
712
713
- for i , chunk in enumerate (
714
- r .iter_content (chunk_size = chunk_size ), 1
715
- ):
716
- if chunk :
717
- elapsed = time .time () - start
718
- dl_progress += len (chunk )
719
- txz .write (chunk )
720
-
721
- progress = float (i ) / float (total )
722
- if progress >= 1. :
723
- progress = 1
724
- progress = round (progress * 100 , 0 )
725
-
726
- if progress != last_progress :
727
- text = self .update_progress (
728
- progress ,
729
- f'Downloading: { f } ' ,
730
- elapsed ,
731
- chunk_size
732
- )
733
-
734
- if progress % 10 == 0 :
735
- # Not for user output, but for callback
736
- # heartbeats
737
- iocage_lib .ioc_common .logit (
738
- {
739
- 'level' : 'INFO' ,
740
- 'message' : text .rstrip ()
741
- },
742
- _callback = self .callback ,
743
- silent = True )
744
-
745
- last_progress = progress
746
- start = time .time ()
713
+ try :
714
+ for i , chunk in enumerate (
715
+ r .iter_content (chunk_size = chunk_size ), 1
716
+ ):
717
+ if chunk :
718
+ elapsed = time .time () - start
719
+ dl_progress += len (chunk )
720
+ txz .write (chunk )
721
+
722
+ progress = float (i ) / float (total )
723
+ if progress >= 1. :
724
+ progress = 1
725
+ progress = round (progress * 100 , 0 )
726
+
727
+ if progress != last_progress :
728
+ text = self .update_progress (
729
+ progress ,
730
+ f'Downloading: { f } ' ,
731
+ elapsed ,
732
+ chunk_size
733
+ )
734
+
735
+ if progress % 10 == 0 :
736
+ # Not for user output, but for callback
737
+ # heartbeats
738
+ iocage_lib .ioc_common .logit (
739
+ {
740
+ 'level' : 'INFO' ,
741
+ 'message' : text .rstrip ()
742
+ },
743
+ _callback = self .callback ,
744
+ silent = True )
745
+
746
+ last_progress = progress
747
+ start = time .time ()
748
+ except requests .exceptions .ChunkedEncodingError as exc :
749
+ iocage_lib .ioc_common .logit (
750
+ {
751
+ "level" : "EXCEPTION" ,
752
+ "message" : f"Please check your internet connection. Details: { exc } " ,
753
+ },
754
+ _callback = self .callback
755
+ )
747
756
748
757
def update_progress (self , progress , display_text , elapsed , chunk_size ):
749
758
"""
0 commit comments