mirror of
https://github.com/apache/superset.git
synced 2026-04-20 08:34:37 +00:00
chore: enable ruff lint rule TRY201 and B904 to improve raise stack traces (#29166)
This commit is contained in:
committed by
GitHub
parent
5167d20f27
commit
4bb2e2f8af
@@ -55,8 +55,9 @@ def _create_query_context_from_form(form_data: dict[str, Any]) -> QueryContext:
|
||||
return ChartDataQueryContextSchema().load(form_data)
|
||||
except KeyError as ex:
|
||||
raise ValidationError("Request is incorrect") from ex
|
||||
except ValidationError as error:
|
||||
raise error
|
||||
except ValidationError: # pylint: disable=try-except-raise
|
||||
# Make sure to bubble this up
|
||||
raise
|
||||
|
||||
|
||||
def _load_user_from_job_metadata(job_metadata: dict[str, Any]) -> User:
|
||||
@@ -96,7 +97,7 @@ def load_chart_data_into_cache(
|
||||
)
|
||||
except SoftTimeLimitExceeded as ex:
|
||||
logger.warning("A timeout occurred while loading chart data, error: %s", ex)
|
||||
raise ex
|
||||
raise
|
||||
except Exception as ex:
|
||||
# TODO: QueryContext should support SIP-40 style errors
|
||||
error = str(ex.message if hasattr(ex, "message") else ex)
|
||||
@@ -104,7 +105,7 @@ def load_chart_data_into_cache(
|
||||
async_query_manager.update_job(
|
||||
job_metadata, async_query_manager.STATUS_ERROR, errors=errors
|
||||
)
|
||||
raise ex
|
||||
raise
|
||||
|
||||
|
||||
@celery_app.task(name="load_explore_json_into_cache", soft_time_limit=query_timeout)
|
||||
@@ -162,7 +163,7 @@ def load_explore_json_into_cache( # pylint: disable=too-many-locals
|
||||
logger.warning(
|
||||
"A timeout occurred while loading explore json, error: %s", ex
|
||||
)
|
||||
raise ex
|
||||
raise
|
||||
except Exception as ex:
|
||||
if isinstance(ex, SupersetVizException):
|
||||
errors = ex.errors
|
||||
@@ -173,4 +174,4 @@ def load_explore_json_into_cache( # pylint: disable=too-many-locals
|
||||
async_query_manager.update_job(
|
||||
job_metadata, async_query_manager.STATUS_ERROR, errors=errors
|
||||
)
|
||||
raise ex
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user