Handle 409 from editCategory as non-error

qBittorrent's /torrents/editCategory endpoint returns 409 (Conflict) when
the category already has the specified save path (no change needed).

This is expected behavior when:
- User hasn't changed download_dir setting since last torrent
- Category already has correct save path

Previously logged as warning with full error stack trace, making it look
like an error when it's actually normal operation.

Changes:
- Check for 409 status code from editCategory
- Log friendly message: 'Category already has save path: /path'
- Only log unexpected errors with console.warn

Now both createCategory and editCategory handle 409 gracefully:
- createCategory 409 = category exists
- editCategory 409 = category already has this path
Both are expected, not errors.
This commit is contained in:
Claude
2025-12-22 15:53:15 +00:00
committed by kikootwo
parent 74010a1ebd
commit 0fa10941e1
+7 -2
View File
@@ -423,8 +423,13 @@ export class QBittorrentService {
console.log(`[qBittorrent] Category "${category}" save path updated to: ${this.defaultSavePath}`);
} catch (error) {
console.warn(`[qBittorrent] Failed to update category save path:`, error);
// Don't throw - torrents can still be added with per-torrent savepath parameter
// 409 = category already has this save path (expected, not an error)
if (axios.isAxiosError(error) && error.response?.status === 409) {
console.log(`[qBittorrent] Category "${category}" already has save path: ${this.defaultSavePath}`);
} else {
console.warn(`[qBittorrent] Failed to update category save path:`, error);
// Don't throw - torrents can still be added with per-torrent savepath parameter
}
}
}