Exxtract the exception message from reply to PUT

Might be usefull to debug Internal Server Error

Fixes #1366
This commit is contained in:
Olivier Goffart 2014-03-26 12:02:22 +01:00
parent 98d7ff5116
commit 38344589c4

View file

@ -191,8 +191,16 @@ void PropagateUploadFileQNAM::slotPutFinished()
"It is restored and your edit is in the conflict file."))) {
return;
}
QString errorString = job->reply()->errorString();
done(classifyError(err, _item._httpErrorCode) , job->reply()->errorString());
QByteArray replyContent = job->reply()->readAll();
qDebug() << replyContent; // display the XML error in the debug
QRegExp rx("<s:message>(.*)</s:message>"); // Issue #1366: display server exception
if (rx.indexIn(QString::fromUtf8(replyContent)) != -1) {
errorString += QLatin1String(" (") + rx.cap(1) + QLatin1Char(')');
}
done(classifyError(err, _item._httpErrorCode), errorString);
return;
}