From 47dd3c2b6fc87a0612718c33f020d3419b8d1f0c Mon Sep 17 00:00:00 2001 From: lzzy12 Date: Sun, 5 Apr 2020 14:12:13 +0530 Subject: [PATCH] gdriveTools: Handle unhandled exception in clone method Signed-off-by: lzzy12 --- bot/helper/mirror_utils/upload_utils/gdriveTools.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py index 6bb1c94..8f7e815 100644 --- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py +++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py @@ -246,7 +246,14 @@ class GoogleDriveHelper: def clone(self, link): self.transferred_size = 0 - file_id = self.getIdFromUrl(link) + try: + file_id = self.getIdFromUrl(link) + except KeyError: + msg = "Google drive ID could not be found in the provided link" + return msg + except IndexError: + msg = "Google drive ID could not be found in the provided link" + return msg msg = "" LOGGER.info(f"File ID: {file_id}") try: