From d1b20be4ec46883430872eebd2fac0a999edf2db 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 3d3526ed8..eba42f7c4 100644 --- a/plugins/sftp/mounter.cpp +++ b/plugins/sftp/mounter.cpp @@ -175,15 +175,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(); @@ -191,7 +199,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);