Properly handle exceptions when create torrent

Closes #15518.
PR #15532.
This commit is contained in:
Vladimir Golovnev 2021-10-08 12:47:31 +03:00 committed by GitHub
parent 338d9a0848
commit ac5c264e66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -224,9 +224,13 @@ void TorrentCreatorThread::run()
emit updateProgress(100);
emit creationSuccess(m_params.savePath, parentPath);
}
catch (const std::exception &e)
catch (const RuntimeError &err)
{
emit creationFailure(e.what());
emit creationFailure(tr("Create new torrent file failed. Reason: %1.").arg(err.message()));
}
catch (const std::exception &err)
{
emit creationFailure(tr("Create new torrent file failed. Reason: %1.").arg(QString::fromLocal8Bit(err.what())));
}
}