Skip to content

Commit

Permalink
fix(ingest/looker): handle sdk error for folder_ancestors (datahub-pr…
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurinehate authored Oct 10, 2024
1 parent a219316 commit 9df65e8
Showing 1 changed file with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,25 @@ def folder_ancestors(
fields: Union[str, List[str]] = ["id", "name", "parent_id"],
) -> Sequence[Folder]:
self.client_stats.folder_calls += 1
return self.client.folder_ancestors(
folder_id,
self.__fields_mapper(fields),
transport_options=self.transport_options,
)
try:
return self.client.folder_ancestors(
folder_id,
self.__fields_mapper(fields),
transport_options=self.transport_options,
)
except SDKError as e:
if "Looker Not Found (404)" in str(e):
# Folder ancestors not found
logger.info(
f"Could not find ancestors for folder with id {folder_id}: 404 error"
)
else:
logger.warning(
f"Could not find ancestors for folder with id {folder_id}"
)
logger.warning(f"Failure was {e}")
# Folder ancestors not found
return []

def all_connections(self):
self.client_stats.all_connections_calls += 1
Expand Down

0 comments on commit 9df65e8

Please sign in to comment.