forked from qt-creator/qt-creator
LanguageClient: Do not send out invalid errors
An error is expected to contain an error message so add one that misses one. Additionally assert when trying to set an error to a response that is invalid (does not contain message or code.) Fixes: QTCREATORBUG-28598 Fixes: QTCREATORBUG-27856 Change-Id: I0631433d847610531758d297a93a5c7cdfdc6c1d Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1891,6 +1891,7 @@ void ClientPrivate::handleMethod(const QString &method, const MessageId &id, con
|
||||
Response<JsonObject, JsonObject> response(id);
|
||||
ResponseError<JsonObject> error;
|
||||
error.setCode(ResponseError<JsonObject>::MethodNotFound);
|
||||
error.setMessage(QString("The client cannot handle the method '%1'.").arg(method));
|
||||
response.setError(error);
|
||||
sendResponse(response);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user