Commit 66245a79 authored by Andre Heinecke's avatar Andre Heinecke

Replace exception with direct error handling

parent fe12ed2a
...@@ -176,31 +176,22 @@ DecryptVerifyFilesController::Private::Private(DecryptVerifyFilesController *qq) ...@@ -176,31 +176,22 @@ DecryptVerifyFilesController::Private::Private(DecryptVerifyFilesController *qq)
void DecryptVerifyFilesController::Private::slotWizardOperationPrepared() void DecryptVerifyFilesController::Private::slotWizardOperationPrepared()
{ {
try { ensureWizardCreated();
ensureWizardCreated(); std::vector<shared_ptr<Task> > tasks = buildTasks(m_filesAfterPreparation, shared_ptr<OverwritePolicy>(new OverwritePolicy(m_wizard)));
std::vector<shared_ptr<Task> > tasks = buildTasks(m_filesAfterPreparation, shared_ptr<OverwritePolicy>(new OverwritePolicy(m_wizard))); if (tasks.empty()) {
kleo_assert(m_runnableTasks.empty()); reportError(makeGnuPGError(GPG_ERR_ASS_NO_INPUT), i18n("No usable inputs found"));
m_runnableTasks.swap(tasks); }
kleo_assert(m_runnableTasks.empty());
shared_ptr<TaskCollection> coll(new TaskCollection); m_runnableTasks.swap(tasks);
Q_FOREACH (const shared_ptr<Task> &i, m_runnableTasks) {
q->connectTask(i);
}
coll->setTasks(m_runnableTasks);
m_wizard->setTaskCollection(coll);
QTimer::singleShot(0, q, SLOT(schedule()));
} catch (const Kleo::Exception &e) { shared_ptr<TaskCollection> coll(new TaskCollection);
reportError(e.error().encodedError(), e.message()); Q_FOREACH (const shared_ptr<Task> &i, m_runnableTasks) {
} catch (const std::exception &e) { q->connectTask(i);
reportError(gpg_error(GPG_ERR_UNEXPECTED),
i18n("Caught unexpected exception in DecryptVerifyFilesController::Private::slotWizardOperationPrepared: %1",
QString::fromLocal8Bit(e.what())));
} catch (...) {
reportError(gpg_error(GPG_ERR_UNEXPECTED),
i18n("Caught unknown exception in DecryptVerifyFilesController::Private::slotWizardOperationPrepared"));
} }
coll->setTasks(m_runnableTasks);
m_wizard->setTaskCollection(coll);
QTimer::singleShot(0, q, SLOT(schedule()));
} }
void DecryptVerifyFilesController::Private::slotWizardCanceled() void DecryptVerifyFilesController::Private::slotWizardCanceled()
...@@ -390,10 +381,6 @@ QStringList DecryptVerifyFilesController::Private::prepareWizardFromPassedFiles( ...@@ -390,10 +381,6 @@ QStringList DecryptVerifyFilesController::Private::prepareWizardFromPassedFiles(
kleo_assert(counter == static_cast<unsigned>(fileNames.size())); kleo_assert(counter == static_cast<unsigned>(fileNames.size()));
if (!counter) {
throw Kleo::Exception(makeGnuPGError(GPG_ERR_ASS_NO_INPUT), i18n("No usable inputs found"));
}
m_wizard->setOutputDirectory(heuristicBaseDirectory(m_passedFiles)); m_wizard->setOutputDirectory(heuristicBaseDirectory(m_passedFiles));
return fileNames; return fileNames;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment