From 3fcb87e0edded6e967870265bb280d0b93bcb921 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Thu, 25 Apr 2019 20:47:50 +0200 Subject: [PATCH] [sftp] Improve error reporting --- plugins/sftp/mounter.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/sftp/mounter.cpp b/plugins/sftp/mounter.cpp index f55fafedf..95eb5c35d 100644 --- a/plugins/sftp/mounter.cpp +++ b/plugins/sftp/mounter.cpp @@ -180,15 +180,23 @@ void Mounter::onError(QProcess::ProcessError error) { if (error == QProcess::FailedToStart) { - qCDebug(KDECONNECT_PLUGIN_SFTP) << "Process failed to start"; + qCDebug(KDECONNECT_PLUGIN_SFTP) << "sshfs process failed to start"; m_started = false; Q_EMIT failed(i18n("Failed to start sshfs")); + } else if(error == QProcess::ProcessError::Crashed) { + qCDebug(KDECONNECT_PLUGIN_SFTP) << "sshfs process crashed"; + m_started = false; + Q_EMIT failed(i18n("sshfs process crashed")); + } else { + qCDebug(KDECONNECT_PLUGIN_SFTP) << "sshfs process error" << error; + m_started = false; + Q_EMIT failed(i18n("Unknown error in sshfs")); } } void Mounter::onFinished(int exitCode, QProcess::ExitStatus exitStatus) { - if (exitStatus == QProcess::NormalExit) + if (exitStatus == QProcess::NormalExit && exitCode == 0) { qCDebug(KDECONNECT_PLUGIN_SFTP) << "Process finished (exit code: " << exitCode << ")"; Q_EMIT unmounted(); @@ -196,7 +204,7 @@ void Mounter::onFinished(int exitCode, QProcess::ExitStatus exitStatus) else { qCDebug(KDECONNECT_PLUGIN_SFTP) << "Process failed (exit code:" << exitCode << ")"; - Q_EMIT failed(i18n("Error when accessing to filesystem")); + Q_EMIT failed(i18n("Error when accessing to filesystem. sshfs finished with exit code %0").arg(exitCode)); } unmount(true);