From dede64d65a0c01fb561ef5c1a9cadbc983829482 Mon Sep 17 00:00:00 2001 From: Eric Vergnaud Date: Thu, 10 Oct 2024 14:03:16 +0200 Subject: [PATCH] Catch all errors when checking Databricks path, notably BadRequest ones (#156) Progresses #https://github.com/databrickslabs/ucx/issues/2882 Co-authored-by: Eric Vergnaud --- src/databricks/labs/blueprint/paths.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/databricks/labs/blueprint/paths.py b/src/databricks/labs/blueprint/paths.py index d66204c..b00d64e 100644 --- a/src/databricks/labs/blueprint/paths.py +++ b/src/databricks/labs/blueprint/paths.py @@ -20,7 +20,7 @@ from urllib.parse import quote_from_bytes as urlquote_from_bytes from databricks.sdk import WorkspaceClient -from databricks.sdk.errors import DatabricksError, NotFound, ResourceDoesNotExist +from databricks.sdk.errors import DatabricksError, ResourceDoesNotExist from databricks.sdk.service.files import FileInfo from databricks.sdk.service.workspace import ( ExportFormat, @@ -609,7 +609,7 @@ def exists(self, *, follow_symlinks: bool = True) -> bool: try: self._cached_file_info = self._ws.dbfs.get_status(self.as_posix()) return True - except NotFound: + except DatabricksError: return False def _mkdir(self) -> None: @@ -754,7 +754,7 @@ def exists(self, *, follow_symlinks: bool = True) -> bool: try: self._cached_object_info = self._ws.workspace.get_status(self.as_posix()) return True - except NotFound: + except DatabricksError: return False def _mkdir(self) -> None: