mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 12:50:09 +00:00
Improve logging for qBittorrent category creation
The 409 (Conflict) status code from qBittorrent's createCategory endpoint means 'category already exists', which is expected behavior, not an error. Previously, the full error object was logged with console.log(), making it look like an error in the logs when it's actually normal operation. Changes: - Check for 409 status code specifically - Log friendly message: 'Category already exists' for 409 - Only log unexpected errors with console.warn - Cleaner logs that don't alarm users The flow still works correctly: 1. Try createCategory (succeeds if new, 409 if exists) 2. Always editCategory to update save path to match current config 3. Both operations complete successfully
This commit is contained in:
@@ -393,10 +393,15 @@ export class QBittorrentService {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(`[qBittorrent] Category "${category}" created/exists`);
|
console.log(`[qBittorrent] Category "${category}" created`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Category might already exist - that's OK
|
// 409 = category already exists (expected, not an error)
|
||||||
console.log(`[qBittorrent] Category creation returned:`, error);
|
if (axios.isAxiosError(error) && error.response?.status === 409) {
|
||||||
|
console.log(`[qBittorrent] Category "${category}" already exists`);
|
||||||
|
} else {
|
||||||
|
// Unexpected error, but don't fail - editCategory below will handle it
|
||||||
|
console.warn(`[qBittorrent] Failed to create category:`, error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always update the category's save path to ensure it matches current config
|
// Always update the category's save path to ensure it matches current config
|
||||||
|
|||||||
Reference in New Issue
Block a user