mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 21:03:30 -07:00
Don't throw exception in TorrentInfo::saveToFile()
This commit is contained in:
parent
41fc0fd084
commit
78459fcb31
4 changed files with 13 additions and 20 deletions
|
@ -43,7 +43,6 @@
|
|||
#include "base/bittorrent/magneturi.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/exceptions.h"
|
||||
#include "base/global.h"
|
||||
#include "base/net/downloadmanager.h"
|
||||
#include "base/settingsstorage.h"
|
||||
|
@ -473,14 +472,11 @@ void AddNewTorrentDialog::saveTorrentFile()
|
|||
if (!path.endsWith(torrentFileExtension, Qt::CaseInsensitive))
|
||||
path += torrentFileExtension;
|
||||
|
||||
try
|
||||
{
|
||||
m_torrentInfo.saveToFile(path);
|
||||
}
|
||||
catch (const RuntimeError &err)
|
||||
const nonstd::expected<void, QString> result = m_torrentInfo.saveToFile(path);
|
||||
if (!result)
|
||||
{
|
||||
QMessageBox::critical(this, tr("I/O Error")
|
||||
, tr("Couldn't export torrent metadata file '%1'. Reason: %2.").arg(path, err.message()));
|
||||
, tr("Couldn't export torrent metadata file '%1'. Reason: %2.").arg(path, result.error()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue