mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-28 02:21:57 +00:00
Report InvalidParams for serialization error
This commit is contained in:
parent
5599ddd343
commit
26d76b75c7
@ -22,9 +22,10 @@ limitations under the License.
|
|||||||
#include "query_utils.hh"
|
#include "query_utils.hh"
|
||||||
#include "serializers/json.hh"
|
#include "serializers/json.hh"
|
||||||
|
|
||||||
using namespace clang;
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
|
using namespace clang;
|
||||||
|
|
||||||
MAKE_HASHABLE(ccls::SymbolIdx, t.usr, t.kind);
|
MAKE_HASHABLE(ccls::SymbolIdx, t.usr, t.kind);
|
||||||
|
|
||||||
@ -204,8 +205,16 @@ void MessageHandler::Run(InMessage &msg) {
|
|||||||
if (it != method2request.end()) {
|
if (it != method2request.end()) {
|
||||||
try {
|
try {
|
||||||
it->second(reader, reply);
|
it->second(reader, reply);
|
||||||
|
} catch (std::invalid_argument &ex) {
|
||||||
|
lsResponseError err;
|
||||||
|
err.code = lsErrorCodes::InvalidParams;
|
||||||
|
err.message = "invalid params of " + msg.method + ": " + ex.what();
|
||||||
|
reply.Error(err);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
LOG_S(ERROR) << "failed to process request " << msg.method;
|
lsResponseError err;
|
||||||
|
err.code = lsErrorCodes::InternalError;
|
||||||
|
err.message = "failed to process " + msg.method;
|
||||||
|
reply.Error(err);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lsResponseError err;
|
lsResponseError err;
|
||||||
|
Loading…
Reference in New Issue
Block a user