fix: 清理全局 except:pass(22处)改为 logger.warning 记录异常
Deploy / Build Production Runtime Images (push) Has been skipped
Deploy / Deploy Production (push) Has been skipped
Deploy / Production Browser E2E (push) Has been skipped
Tests / lint (pull_request) Failing after 147h14m3s
Tests / test (pull_request) Failing after 147h14m3s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 147h14m28s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 147h14m34s
Deploy / Deploy Staging (push) Failing after 147h14m58s
CI/CD Pipeline / Frontend Lint (push) Failing after 147h15m21s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 147h15m27s
Deploy / Build Production Runtime Images (push) Has been skipped
Deploy / Deploy Production (push) Has been skipped
Deploy / Production Browser E2E (push) Has been skipped
Tests / lint (pull_request) Failing after 147h14m3s
Tests / test (pull_request) Failing after 147h14m3s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 147h14m28s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 147h14m34s
Deploy / Deploy Staging (push) Failing after 147h14m58s
CI/CD Pipeline / Frontend Lint (push) Failing after 147h15m21s
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 147h15m27s
This commit is contained in:
@@ -31,6 +31,9 @@ from packages.application.auth.password_reset_use_case import (
|
||||
from packages.application.auth.register_user_use_case import RegisterUserRequest as RegisterUseCaseRequest
|
||||
from packages.application.auth.register_user_use_case import RegisterUserUseCase, VerifyEmailRequest, VerifyEmailUseCase
|
||||
from packages.ports.user_repository import UserRepository
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
bearer_scheme = HTTPBearer(auto_error=False)
|
||||
|
||||
@@ -248,8 +251,8 @@ async def logout(
|
||||
payload = jwt.decode(credentials.credentials, settings.JWT_SECRET_KEY, algorithms=["HS256"])
|
||||
exp = payload.get("exp", 0)
|
||||
blacklist_token(credentials.credentials, exp)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in apps/api/app/api/routes/auth.py: {e}", exc_info=True)
|
||||
return MessageResponse(message="已登出")
|
||||
|
||||
@router.get("/me", response_model=CurrentUserResponse)
|
||||
|
||||
@@ -300,8 +300,8 @@ class AutoClipService:
|
||||
if min_quality is not None:
|
||||
try:
|
||||
result["min_quality_score"] = float(min_quality)
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
except (TypeError, ValueError) as e:
|
||||
logger.warning(f"Operation failed in apps/api/app/services/auto_clip_service.py: {e}", exc_info=True)
|
||||
|
||||
# 分类筛选
|
||||
category = requirements.get("category") or requirements.get("classification")
|
||||
|
||||
@@ -253,8 +253,8 @@ class EditingModeProcessor:
|
||||
try:
|
||||
if p != output_path:
|
||||
os.remove(p)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in apps/worker/video_processing/editing_modes.py: {e}", exc_info=True)
|
||||
|
||||
return output_path
|
||||
|
||||
@@ -314,8 +314,8 @@ class EditingModeProcessor:
|
||||
|
||||
try:
|
||||
os.remove(concat_file)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in apps/worker/video_processing/editing_modes.py: {e}", exc_info=True)
|
||||
|
||||
return output_path
|
||||
|
||||
@@ -438,8 +438,8 @@ class EditingModeProcessor:
|
||||
if temp_file and temp_file != output_path:
|
||||
try:
|
||||
os.remove(temp_file)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in apps/worker/video_processing/editing_modes.py: {e}", exc_info=True)
|
||||
|
||||
return output_path
|
||||
|
||||
@@ -548,8 +548,8 @@ class EditingModeProcessor:
|
||||
try:
|
||||
if temp_file != output_path:
|
||||
os.remove(temp_file)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in apps/worker/video_processing/editing_modes.py: {e}", exc_info=True)
|
||||
|
||||
return output_path
|
||||
|
||||
@@ -672,8 +672,8 @@ class EditingModeProcessor:
|
||||
try:
|
||||
if temp_file != output_path:
|
||||
os.remove(temp_file)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in apps/worker/video_processing/editing_modes.py: {e}", exc_info=True)
|
||||
|
||||
return output_path
|
||||
|
||||
|
||||
@@ -310,8 +310,8 @@ class VideoComposeService:
|
||||
try:
|
||||
if p != output_path:
|
||||
os.remove(p)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in apps/worker/video_processing/video_compose_service.py: {e}", exc_info=True)
|
||||
|
||||
return output_path
|
||||
|
||||
@@ -353,8 +353,8 @@ class VideoComposeService:
|
||||
|
||||
try:
|
||||
os.remove(concat_file)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in apps/worker/video_processing/video_compose_service.py: {e}", exc_info=True)
|
||||
|
||||
return output_path
|
||||
|
||||
@@ -423,8 +423,8 @@ class VideoComposeService:
|
||||
if temp_file and temp_file != output_path:
|
||||
try:
|
||||
os.remove(temp_file)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in apps/worker/video_processing/video_compose_service.py: {e}", exc_info=True)
|
||||
|
||||
return output_path
|
||||
|
||||
@@ -484,8 +484,8 @@ class VideoComposeService:
|
||||
try:
|
||||
if temp_file != output_path:
|
||||
os.remove(temp_file)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in apps/worker/video_processing/video_compose_service.py: {e}", exc_info=True)
|
||||
|
||||
return output_path
|
||||
|
||||
@@ -550,8 +550,8 @@ class VideoComposeService:
|
||||
try:
|
||||
if temp_file != output_path:
|
||||
os.remove(temp_file)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in apps/worker/video_processing/video_compose_service.py: {e}", exc_info=True)
|
||||
|
||||
return output_path
|
||||
|
||||
|
||||
@@ -121,8 +121,8 @@ class AssetAnalyzer:
|
||||
|
||||
if os.path.exists(self._temp_dir):
|
||||
shutil.rmtree(self._temp_dir)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in apps/worker/worker_app/tasks/asset_analyzer.py: {e}", exc_info=True)
|
||||
|
||||
def get_video_info(self) -> VideoInfo:
|
||||
"""获取视频基本信息"""
|
||||
|
||||
@@ -132,5 +132,5 @@ def compose_video(self, job_id: str, **kwargs):
|
||||
output_path = f"/tmp/video_output/{job_id}.mp4"
|
||||
if Path(output_path).exists():
|
||||
Path(output_path).unlink()
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in apps/worker/worker_app/tasks/compose_video.py: {e}", exc_info=True)
|
||||
|
||||
@@ -344,8 +344,8 @@ def render_edit_plan(self, plan_id: str) -> dict:
|
||||
if plan and plan.status.value == "rendering":
|
||||
plan.mark_failed()
|
||||
plan_repo.update(plan)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in apps/worker/worker_app/tasks/edit_plan_generation.py: {e}", exc_info=True)
|
||||
raise self.retry(exc=exc, countdown=60)
|
||||
|
||||
return {"status": "error", "message": "数据库连接失败"}
|
||||
|
||||
@@ -6,6 +6,9 @@ import argparse
|
||||
import os
|
||||
import time
|
||||
from pathlib import Path
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
@@ -39,8 +42,8 @@ def remove_empty_dirs(root: Path) -> None:
|
||||
for path in sorted((p for p in root.rglob("*") if p.is_dir()), key=lambda p: len(p.parts), reverse=True):
|
||||
try:
|
||||
path.rmdir()
|
||||
except OSError:
|
||||
pass
|
||||
except OSError as e:
|
||||
logger.warning(f"Operation failed in scripts/cleanup_generated_files.py: {e}", exc_info=True)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
|
||||
@@ -12,6 +12,9 @@ import sys
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
CORE_ENDPOINTS = [
|
||||
{
|
||||
@@ -65,7 +68,7 @@ def make_request(base_url, endpoint, token=None):
|
||||
try:
|
||||
body = e.read().decode()[:200]
|
||||
except:
|
||||
pass
|
||||
logger.warning(f"Operation failed in scripts/smoke_test.py: {e}", exc_info=True)
|
||||
return {"status": e.code, "elapsed_ms": elapsed, "body": body, "error": None}
|
||||
except Exception as e:
|
||||
return {"status": 0, "elapsed_ms": 0, "body": "", "error": str(e)}
|
||||
|
||||
@@ -333,8 +333,8 @@ def _install_mocks():
|
||||
sys.modules["app.schemas.duplication"] = dup_schemas_mod
|
||||
sys.modules.setdefault("app.schemas", types.ModuleType("app.schemas"))
|
||||
sys.modules["app.schemas"].duplication = dup_schemas_mod
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f"Operation failed in tests/integration/test_duplication_upload_error_handling.py: {e}", exc_info=True)
|
||||
|
||||
return User, AuthenticatedUser
|
||||
|
||||
@@ -347,6 +347,9 @@ for ns in ["app", "app.api", "app.api.routes"]:
|
||||
sys.modules[ns] = types.ModuleType(ns)
|
||||
|
||||
import importlib.util
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_spec = importlib.util.spec_from_file_location("app.api.routes.duplication", "/tmp/duplication_routes_fixed.py")
|
||||
duplication = importlib.util.module_from_spec(_spec)
|
||||
|
||||
@@ -55,8 +55,8 @@ try:
|
||||
import cv2 as _cv2
|
||||
if not isinstance(_cv2, MagicMock):
|
||||
_HAS_CV2 = True
|
||||
except (ImportError, ModuleNotFoundError):
|
||||
pass
|
||||
except (ImportError, ModuleNotFoundError) as e:
|
||||
logger.warning(f"Operation failed in tests/unit/test_dedup_engine.py: {e}", exc_info=True)
|
||||
|
||||
import numpy as np # noqa: E402
|
||||
import pytest # noqa: E402
|
||||
@@ -65,6 +65,10 @@ import pytest # noqa: E402
|
||||
if not _HAS_CV2:
|
||||
_mock_if_absent("cv2")
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
from apps.worker.video_processing.dedup import ( # noqa: E402
|
||||
VideoDeduplicator,
|
||||
VideoFingerprint,
|
||||
|
||||
@@ -17,6 +17,9 @@ from packages.adapters.sqlalchemy_impl.edit_template_repository import (
|
||||
from packages.adapters.sqlalchemy_impl.models import Base
|
||||
from packages.domain.edit_plan import EditPlan, EditPlanStatus
|
||||
from packages.domain.edit_template import EditTemplate, EditTemplateStatus
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# ── EditTemplate 领域实体测试 ──────────────────────────────────────────
|
||||
@@ -109,24 +112,24 @@ class TestEditPlan:
|
||||
try:
|
||||
p.start_rendering() # draft → rendering 不合法
|
||||
assert False, "应该抛出 ValueError"
|
||||
except ValueError:
|
||||
pass
|
||||
except ValueError as e:
|
||||
logger.warning(f"Operation failed in tests/unit/test_phase8_edit_models.py: {e}", exc_info=True)
|
||||
|
||||
def test_mark_completed_from_non_rendering_raises(self):
|
||||
p = EditPlan.create("tpl-1", "test")
|
||||
try:
|
||||
p.mark_completed() # draft → completed 不合法
|
||||
assert False, "应该抛出 ValueError"
|
||||
except ValueError:
|
||||
pass
|
||||
except ValueError as e:
|
||||
logger.warning(f"Operation failed in tests/unit/test_phase8_edit_models.py: {e}", exc_info=True)
|
||||
|
||||
def test_reset_from_non_failed_raises(self):
|
||||
p = EditPlan.create("tpl-1", "test")
|
||||
try:
|
||||
p.reset_to_draft() # draft → draft 不合法
|
||||
assert False, "应该抛出 ValueError"
|
||||
except ValueError:
|
||||
pass
|
||||
except ValueError as e:
|
||||
logger.warning(f"Operation failed in tests/unit/test_phase8_edit_models.py: {e}", exc_info=True)
|
||||
|
||||
|
||||
# ── Repository 集成测试(内存 SQLite) ─────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user