fix: replace bare except clauses with except Exception

Bare `except:` catches BaseException including KeyboardInterrupt and
SystemExit. Replaced 4 instances with `except Exception:`.
pull/3489/head
haosenwang1018 2026-02-25 12:04:31 +00:00
parent 4161d1d80a
commit d6a1931369
4 changed files with 4 additions and 4 deletions

View File

@ -1439,7 +1439,7 @@ def validate_toml_file(file_path: str) -> bool:
try:
toml.load(file_path)
except:
except Exception:
log.error(f"{msg} FAILED: is not a valid toml file.")
return False
log.info(f"{msg} SUCCESS")

View File

@ -22,7 +22,7 @@ def setup_logging(clean=False, debug=False):
if clean and os.path.isfile("setup.log"):
os.remove("setup.log")
time.sleep(0.1) # prevent race condition
except:
except Exception:
pass
if sys.version_info >= (3, 9):

View File

@ -47,7 +47,7 @@ def _get_tag_checkbox_updates(caption, quick_tags, quick_tags_set):
def paginate_go(page, max_page):
try:
page = float(page)
except:
except Exception:
msgbox(f"Invalid page num: {page}")
return
return paginate(page, max_page, 0)

View File

@ -44,7 +44,7 @@ class SDModelType:
self.model_type = ModelType.SD2
elif hasKeyPrefix("model."):
self.model_type = ModelType.SD1
except:
except Exception:
pass
# print(f"Model type: {self.model_type}")