Re: KDevelop can't load project: "too large document"?
Matthew Woehlke <[email protected]>
| Newsgroups | gmane.comp.kde.users.kdevelop |
|---|---|
| Message-ID | <[email protected]> |
On 2017-12-05 17:38, René J.V. Bertin wrote:
> Maybe you can simply do
>
> connect(job, &CMakeServerImportJob::result, this, [this, job](){
> if (job->error() == 0) {
> manager->integrateData(job->projectData(), job->project());
> } else {
> failedConnection(job->error());
> }
> });
No luck. It appears that failing to parse the JSON is an unrecoverable
error. That is, I see no code to cope with that occurrence, and indeed,
it would normally trip an assert (I'm building RelWithDebInfo, so I
assume and expect asserts are not enabled). The correct fix seems to be
to modify the response handler to handle failing to parse the response.
See attached patch.
The above doesn't *seem* to be necessary with this patch, but I might be
wrong about that.
>> Indeed. At the very least, it shouldn't just quit trying to import the
>> project, leaving KDevelop in a weird state :-).
>
> From the looks of it the cmake importer doesn't do anything in terms of error handling.
Handling an error from the *server* appears to be handled. The patch
hijacks this by synthesizing a response that looks like a server error,
and passing that back up the stack instead of the "real" response which
could not be parsed.
At any rate, see also
https://gitlab.kitware.com/cmake/cmake/issues/17502, especially Brad
King's most recent comment. The plan is to revert cmake!992 for CMake
3.10.1. I still think KDevelop should handle this more gracefully,
though; failing to load the project *and* getting stuck in a state that
the load can't even be canceled is... less than optimal :-).
--
Matthew
kdev-cmake-server.patch
(text/x-patch, 710 B)
diff --git a/plugins/cmake/cmakeserver.cpp b/plugins/cmake/cmakeserver.cpp
index be682b8419..bfdfb6fe02 100644
--- a/plugins/cmake/cmakeserver.cpp
+++ b/plugins/cmake/cmakeserver.cpp
@@ -150,6 +150,10 @@ void CMakeServer::emitResponse(const QByteArray& data)
auto doc = QJsonDocument::fromJson(data, &error);
if (error.error) {
qCWarning(CMAKE) << "error processing" << error.errorString() << data;
+ auto resp = QJsonObject{};
+ resp.insert(QStringLiteral("type"), QStringLiteral("error"));
+ resp.insert(QStringLiteral("errorMessage"), error.errorString());
+ doc = QJsonDocument{resp};
}
Q_ASSERT(doc.isObject());
Q_EMIT response(doc.object());