[sftp] Improve error reporting

This commit is contained in:
Nicolas Fella 2019-04-25 20:47:50 +02:00
parent 20e8f41bb4
commit 3fcb87e0ed

View file

@ -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);