mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 21:03:30 -07:00
Don't use output parameters for error handling
This commit is contained in:
parent
4d480b8761
commit
41fc0fd084
12 changed files with 116 additions and 165 deletions
|
@ -701,14 +701,14 @@ void TorrentsController::addAction()
|
|||
|
||||
for (auto it = data().constBegin(); it != data().constEnd(); ++it)
|
||||
{
|
||||
const BitTorrent::TorrentInfo torrentInfo = BitTorrent::TorrentInfo::load(it.value());
|
||||
if (!torrentInfo.isValid())
|
||||
const nonstd::expected<BitTorrent::TorrentInfo, QString> result = BitTorrent::TorrentInfo::load(it.value());
|
||||
if (!result)
|
||||
{
|
||||
throw APIError(APIErrorType::BadData
|
||||
, tr("Error: '%1' is not a valid torrent file.").arg(it.key()));
|
||||
}
|
||||
|
||||
partialSuccess |= BitTorrent::Session::instance()->addTorrent(torrentInfo, addTorrentParams);
|
||||
partialSuccess |= BitTorrent::Session::instance()->addTorrent(result.value(), addTorrentParams);
|
||||
}
|
||||
|
||||
if (partialSuccess)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue