MCPcopy Create free account
hub / github.com/KDE/kdevelop / slotProcessError

Method slotProcessError

kdevplatform/vcs/dvcs/dvcsjob.cpp:214–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212}
213
214void DVcsJob::slotProcessError( QProcess::ProcessError err )
215{
216 Q_D(DVcsJob);
217
218 d->status = JobFailed;
219
220 setError(OutputJob::FailedShownError); //we don't want to trigger a message box
221
222 d->errorOutput = d->childproc->readAllStandardError();
223
224 QString displayCommand = KShell::joinArgs(dvcsCommand());
225 QString completeErrorText = i18n("Process '%1' exited with status %2\n%3", displayCommand, d->childproc->exitCode(), QString::fromLocal8Bit(d->errorOutput) );
226 setErrorText( completeErrorText );
227
228 QString errorValue;
229 //if trolls add Q_ENUMS for QProcess, then we can use better solution than switch:
230 //QMetaObject::indexOfEnumerator(char*), QQStringLiteral(QMetaEnum::valueToKey())...
231 switch (err)
232 {
233 case QProcess::FailedToStart:
234 errorValue = QStringLiteral("FailedToStart");
235 break;
236 case QProcess::Crashed:
237 errorValue = QStringLiteral("Crashed");
238 break;
239 case QProcess::Timedout:
240 errorValue = QStringLiteral("Timedout");
241 break;
242 case QProcess::WriteError:
243 errorValue = QStringLiteral("WriteError");
244 break;
245 case QProcess::ReadError:
246 errorValue = QStringLiteral("ReadError");
247 break;
248 case QProcess::UnknownError:
249 errorValue = QStringLiteral("UnknownError");
250 break;
251 }
252 qCDebug(VCS) << "Found an error while running" << displayCommand << ":" << errorValue
253 << "Exit code is:" << d->childproc->exitCode();
254 qCDebug(VCS) << "Error:" << completeErrorText;
255 displayOutput(QString::fromLocal8Bit(d->errorOutput));
256 d->model->appendLine(i18n("Command finished with error %1.", errorValue));
257
258 if(verbosity()==Silent) {
259 setVerbosity(Verbose);
260 startOutput();
261 }
262 emitResult();
263}
264
265void DVcsJob::slotProcessExited(int exitCode, QProcess::ExitStatus exitStatus)
266{

Callers

nothing calls this directly

Calls 1

appendLineMethod · 0.45

Tested by

no test coverage detected