@@ -110,12 +110,12 @@ async def list_projects_across_whole_efs(self) -> list[ProjectID]:
110110 _project_id = parse_obj_as (ProjectID , item )
111111 directories .append (_project_id )
112112 except ValueError :
113- _logger .warning (
113+ _logger .error (
114114 "This is not a project ID. This should not happen! %s" ,
115115 _item_path ,
116116 )
117117 else :
118- _logger .warning (
118+ _logger .error (
119119 "This is not a directory. This should not happen! %s" ,
120120 _item_path ,
121121 )
@@ -131,7 +131,16 @@ async def remove_project_efs_data(self, project_id: ProjectID) -> None:
131131
132132 if Path .exists (_dir_path ):
133133 # Remove the directory and all its contents
134- shutil .rmtree (_dir_path )
135- _logger .info ("%s has been deleted." , _dir_path )
134+ try :
135+ shutil .rmtree (_dir_path )
136+ _logger .info ("%s has been deleted." , _dir_path )
137+ except FileNotFoundError as e :
138+ _logger .error ("Directory %s does not exist." , _dir_path )
139+ except PermissionError as e :
140+ _logger .error ("Permission denied when trying to delete %s." , _dir_path )
141+ except NotADirectoryError as e :
142+ _logger .error ("%s is not a directory." , _dir_path )
143+ except OSError as e :
144+ _logger .error ("Error: %s. Issue with path: %s" , e , _dir_path )
136145 else :
137- _logger .warning ("%s does not exist." , _dir_path )
146+ _logger .error ("%s does not exist." , _dir_path )
0 commit comments