mirror of https://github.com/gmbrax/Pilgrim.git
				
				
				
			Add a error handling on backup operation
This commit is contained in:
		
							parent
							
								
									890fc470bb
								
							
						
					
					
						commit
						209099cc5e
					
				|  | @ -27,7 +27,7 @@ class BackupService: | |||
|                         if file_path.is_file(): | ||||
|                             arcname = file_path.relative_to(diaries_root_path.parent) | ||||
|                             zipf.write(file_path, arcname=arcname) | ||||
|                 return True, None | ||||
|                 return True, filename | ||||
|         except Exception as e: | ||||
|             return False, str(e) | ||||
| 
 | ||||
|  |  | |||
|  | @ -306,7 +306,13 @@ class DiaryListScreen(Screen): | |||
|         session = self.app.service_manager.get_session() | ||||
|         if session: | ||||
|             backup_service = BackupService(session) | ||||
|             result = backup_service.create_backup() | ||||
|             result_operation,result_data = backup_service.create_backup() | ||||
|         else: | ||||
|             self.notify("You must be logged in to perform this action") | ||||
|         self.notify(f"Backup result: {result}") | ||||
|         if result_operation: | ||||
|             self.notify(f"Backup result: {result_data}") | ||||
|         else: | ||||
|             self.notify(f"Error performing backup {result_data}") | ||||
|             raise Exception("Error performing backup") | ||||
|             self.app.exit() | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue