korbit-ai[bot] commented on code in PR #33037:
URL: https://github.com/apache/superset/pull/33037#discussion_r2033214112
##########
superset/migrations/shared/migrate_viz/base.py:
##########
@@ -121,34 +121,44 @@ def _migrate_temporal_filter(self, rv_data: dict[str,
Any]) -> None:
@classmethod
def upgrade_slice(cls, slc: Slice) -> None:
- clz = cls(slc.params)
- form_data_bak = copy.deepcopy(clz.data)
+ try:
+ clz = cls(slc.params)
+ form_data_bak = copy.deepcopy(clz.data)
- clz._pre_action()
- clz._migrate()
- clz._post_action()
+ clz._pre_action()
+ clz._migrate()
+ clz._post_action()
- # viz_type depends on the migration and should be set after its
execution
- # because a source viz can be mapped to different target viz types
- slc.viz_type = clz.target_viz_type
+ # viz_type depends on the migration and should be set after its
execution
+ # because a source viz can be mapped to different target viz types
+ slc.viz_type = clz.target_viz_type
- # only backup params
- slc.params = json.dumps({**clz.data, FORM_DATA_BAK_FIELD_NAME:
form_data_bak})
+ # only backup params
+ slc.params = json.dumps(
+ {**clz.data, FORM_DATA_BAK_FIELD_NAME: form_data_bak}
+ )
- if "form_data" in (query_context := try_load_json(slc.query_context)):
- query_context["form_data"] = clz.data
- slc.query_context = json.dumps(query_context)
+ if "form_data" in (query_context :=
try_load_json(slc.query_context)):
+ query_context["form_data"] = clz.data
+ slc.query_context = json.dumps(query_context)
+ except Exception as e:
Review Comment:
Hi @michael-s-molina, I understand your aim here. From a maintainability and
troubleshooting perspective, using specific exceptions can provide quicker
insight into what's going wrong when an error occurs. Logging distinct errors
can help speed up the debugging process for any issues that could arise with
this code in the future. But if you believe that using a general exception is
more suitable in this context, we can proceed with your approach.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]