Don't throw exception in TorrentInfo::saveToFile()

This commit is contained in:
Vladimir Golovnev (Glassez) 2021-10-06 21:53:56 +03:00
parent 41fc0fd084
commit 78459fcb31
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7
4 changed files with 13 additions and 20 deletions

View file

@ -69,7 +69,6 @@
#include <QUuid>
#include "base/algorithm.h"
#include "base/exceptions.h"
#include "base/global.h"
#include "base/logger.h"
#include "base/net/downloadmanager.h"
@ -2317,14 +2316,11 @@ void Session::exportTorrentFile(const TorrentInfo &torrentInfo, const QString &f
newTorrentPath = exportDir.absoluteFilePath(torrentExportFilename);
}
try
{
torrentInfo.saveToFile(newTorrentPath);
}
catch (const RuntimeError &err)
const nonstd::expected<void, QString> result = torrentInfo.saveToFile(newTorrentPath);
if (!result)
{
LogMsg(tr("Couldn't export torrent metadata file '%1'. Reason: %2.")
.arg(newTorrentPath, err.message()), Log::WARNING);
.arg(newTorrentPath, result.error()), Log::WARNING);
}
}
}