- Catch more exceptions when adding a torrent

This commit is contained in:
Christophe Dumez 2008-01-04 20:43:28 +00:00
parent 5e86c8a14d
commit 07c195f475
2 changed files with 36 additions and 1 deletions

View file

@ -557,6 +557,22 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bo
QFile::rename(file,file+".corrupt");
}
}
catch (std::exception& e) {
std::cerr << "Could not decode file, reason: " << e.what() << '\n';
// Display warning to tell user we can't decode the torrent file
if(!from_url.isNull()) {
emit invalidTorrent(from_url);
QFile::remove(file);
}else{
emit invalidTorrent(file);
}
if(fromScanDir) {
// Remove .corrupt file in case it already exists
QFile::remove(file+".corrupt");
//Rename file extension so that it won't display error message more than once
QFile::rename(file,file+".corrupt");
}
}
}
// Check in .priorities file if the user filtered files