From ef3998767ccf87ab604bdae7a37b07fd8068b26e Mon Sep 17 00:00:00 2001 From: root Date: Sun, 27 Sep 2026 19:30:55 +0800 Subject: [PATCH] style(adapters): throw instead of returning never in assertSafeToDeleteData Co-Authored-By: Claude Opus 5.5 --- packages/adapters/src/qbittorrent/safe-delete.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/adapters/src/qbittorrent/safe-delete.ts b/packages/adapters/src/qbittorrent/safe-delete.ts index 0fdcb528..4da2edf2 100644 --- a/packages/adapters/src/qbittorrent/safe-delete.ts +++ b/packages/adapters/src/qbittorrent/safe-delete.ts @@ -42,12 +42,12 @@ export function assertSafeToDeleteData(check: SafeDeleteCheck, instanceId = ""): }; if (check.importVerified !== true) fail("尚未验证入库"); const content = normalize(check.contentPath); - if (!content) return fail("contentPath 不是绝对路径"); + if (!content) throw fail("contentPath 不是绝对路径"); if (isRootLike(content)) fail("contentPath 是根目录"); if (check.libraryRoots.length === 0) fail("未提供媒体库根,无法确认不在库内"); for (const raw of check.libraryRoots) { const root = normalize(raw); - if (!root) return fail(`媒体库根不是绝对路径: ${raw}`); + if (!root) throw fail(`媒体库根不是绝对路径: ${raw}`); if (within(content, root)) fail(`contentPath 位于媒体库 ${root} 内`); if (within(root, content)) fail(`contentPath 包含媒体库 ${root}`); }