Improve error message when the executable path in the launcher is empty
* Show error "executable path is empty" instead of "Unknown error"
This commit is contained in:
parent
f04c482538
commit
268164748f
|
@ -203,6 +203,17 @@ QStringList SyncthingProcess::splitArguments(const QString &arguments)
|
|||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Emits errorOccurred() as if the specified \a error had occurred and sets the specified \a errorString.
|
||||
* \remarks May be called if a precondition for starting the process (that is checked outside of the SyncthingProcess
|
||||
* class itself) has failed (instead of starting the process).
|
||||
*/
|
||||
void SyncthingProcess::reportError(QProcess::ProcessError error, const QString &errorString)
|
||||
{
|
||||
setErrorString(errorString);
|
||||
emit errorOccurred(error);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Stops the currently running process gracefully. If it has been stopped, starts the specified \a program with the specified \a arguments.
|
||||
* \sa See stopSyncthing() for details about \a currentConnection.
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
static SyncthingProcess *mainInstance();
|
||||
static void setMainInstance(SyncthingProcess *mainInstance);
|
||||
static QStringList splitArguments(const QString &arguments);
|
||||
void reportError(QProcess::ProcessError error, const QString &errorString);
|
||||
#ifdef LIB_SYNCTHING_CONNECTOR_BOOST_PROCESS
|
||||
QProcess::ProcessState state() const;
|
||||
void start(const QString &program, const QStringList &arguments, QIODevice::OpenMode openMode = QIODevice::ReadOnly);
|
||||
|
|
|
@ -123,7 +123,7 @@ void SyncthingLauncher::launch(const Settings::Launcher &launcherSettings)
|
|||
return;
|
||||
}
|
||||
if (!launcherSettings.useLibSyncthing && launcherSettings.syncthingPath.isEmpty()) {
|
||||
emit errorOccurred(QProcess::FailedToStart);
|
||||
m_process.reportError(QProcess::FailedToStart, QStringLiteral("executable path is empty"));
|
||||
return;
|
||||
}
|
||||
if (launcherSettings.useLibSyncthing) {
|
||||
|
|
Loading…
Reference in New Issue