Skip to content

Commit

Permalink
fix(ingest/looker) : Handle DeserializeError to improve error reporti…
Browse files Browse the repository at this point in the history
…ng. (#11457)

Co-authored-by: Harshal Sheth <[email protected]>
  • Loading branch information
sagar-salvi-apptware and hsheth2 authored Oct 3, 2024
1 parent 86de271 commit 107cd64
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
)

from looker_sdk.error import SDKError
from looker_sdk.rtl.serialize import DeserializeError
from looker_sdk.sdk.api40.models import (
LookmlModelExplore,
LookmlModelExploreField,
Expand Down Expand Up @@ -1131,7 +1132,16 @@ def from_api( # noqa: C901
logger.warning(
f"Failed to extract explore {explore_name} from model {model}: {e}"
)

except DeserializeError as e:
reporter.warning(
title="Failed to fetch explore from the Looker API",
message=(
"An error occurred while extracting the explore from the model. "
"Please check the explore and model configurations."
),
context=f"Explore: {explore_name}, Model: {model}",
exc=e,
)
except AssertionError:
reporter.report_warning(
title="Unable to find Views",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
)

from looker_sdk.error import SDKError
from looker_sdk.rtl.serialize import DeserializeError
from looker_sdk.sdk.api40.models import (
Dashboard,
DashboardElement,
Expand Down Expand Up @@ -1288,12 +1289,13 @@ def process_dashboard(
dashboard_id=dashboard_id,
fields=fields,
)
except SDKError:
except (SDKError, DeserializeError) as e:
# A looker dashboard could be deleted in between the list and the get
self.reporter.report_warning(
title="Error Loading Dashboard",
title="Failed to fetch dashboard from the Looker API",
message="Error occurred while attempting to loading dashboard from Looker API. Skipping.",
context=f"Dashboard ID: {dashboard_id}",
exc=e,
)
return [], None, dashboard_id, start_time, datetime.datetime.now()

Expand Down

0 comments on commit 107cd64

Please sign in to comment.