mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +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
@@ -198,15 +198,15 @@ def delete_all_inserted_dashboards():
|
||||
for dashboard in dashboards_to_delete:
|
||||
try:
|
||||
delete_dashboard(dashboard, False)
|
||||
except Exception as ex:
|
||||
except Exception:
|
||||
logger.error(f"failed to delete {dashboard.id}", exc_info=True)
|
||||
raise ex
|
||||
raise
|
||||
if len(inserted_dashboards_ids) > 0:
|
||||
db.session.commit()
|
||||
inserted_dashboards_ids.clear()
|
||||
except Exception as ex2:
|
||||
except Exception:
|
||||
logger.error("delete_all_inserted_dashboards failed", exc_info=True)
|
||||
raise ex2
|
||||
raise
|
||||
|
||||
|
||||
def delete_dashboard(dashboard: Dashboard, do_commit: bool = False) -> None:
|
||||
@@ -245,15 +245,15 @@ def delete_all_inserted_slices():
|
||||
for slice in slices_to_delete:
|
||||
try:
|
||||
delete_slice(slice, False)
|
||||
except Exception as ex:
|
||||
except Exception:
|
||||
logger.error(f"failed to delete {slice.id}", exc_info=True)
|
||||
raise ex
|
||||
raise
|
||||
if len(inserted_slices_ids) > 0:
|
||||
db.session.commit()
|
||||
inserted_slices_ids.clear()
|
||||
except Exception as ex2:
|
||||
except Exception:
|
||||
logger.error("delete_all_inserted_slices failed", exc_info=True)
|
||||
raise ex2
|
||||
raise
|
||||
|
||||
|
||||
def delete_slice(slice_: Slice, do_commit: bool = False) -> None:
|
||||
@@ -278,15 +278,15 @@ def delete_all_inserted_tables():
|
||||
for table in tables_to_delete:
|
||||
try:
|
||||
delete_sqltable(table, False)
|
||||
except Exception as ex:
|
||||
except Exception:
|
||||
logger.error(f"failed to delete {table.id}", exc_info=True)
|
||||
raise ex
|
||||
raise
|
||||
if len(inserted_sqltables_ids) > 0:
|
||||
db.session.commit()
|
||||
inserted_sqltables_ids.clear()
|
||||
except Exception as ex2:
|
||||
except Exception:
|
||||
logger.error("delete_all_inserted_tables failed", exc_info=True)
|
||||
raise ex2
|
||||
raise
|
||||
|
||||
|
||||
def delete_sqltable(table: SqlaTable, do_commit: bool = False) -> None:
|
||||
@@ -313,15 +313,15 @@ def delete_all_inserted_dbs():
|
||||
for database in databases_to_delete:
|
||||
try:
|
||||
delete_database(database, False)
|
||||
except Exception as ex:
|
||||
except Exception:
|
||||
logger.error(f"failed to delete {database.id}", exc_info=True)
|
||||
raise ex
|
||||
raise
|
||||
if len(inserted_databases_ids) > 0:
|
||||
db.session.commit()
|
||||
inserted_databases_ids.clear()
|
||||
except Exception as ex2:
|
||||
except Exception:
|
||||
logger.error("delete_all_inserted_databases failed", exc_info=True)
|
||||
raise ex2
|
||||
raise
|
||||
|
||||
|
||||
def delete_database(database: Database, do_commit: bool = False) -> None:
|
||||
|
||||
Reference in New Issue
Block a user