fix: use Exception to handle all errors

This commit is contained in:
arkohut 2024-06-10 21:27:35 +08:00
parent 8e9e429a91
commit d20f6cb45b

View File

@ -308,13 +308,8 @@ frontend_favicon = FRONTEND_BUILD_DIR / "favicon.png"
if frontend_favicon.exists():
try:
shutil.copyfile(frontend_favicon, STATIC_DIR / "favicon.png")
except PermissionError:
logging.error(f"No write permission to {STATIC_DIR / 'favicon.png'}")
except OSError as e:
if e.errno == 30: # Read-only file system
logging.error(f"Read-only file system: {STATIC_DIR / 'favicon.png'}")
else:
logging.error(f"OS error occurred: {e}")
except Exception as e:
logging.error(f"An error occurred: {e}")
else:
logging.warning(f"Frontend favicon not found at {frontend_favicon}")