[Mlir-commits] [mlir] [mlir-lsp] Log invalid notification params (PR #89856)

Walter Erquinigo llvmlistbot at llvm.org
Wed Apr 24 09:20:15 PDT 2024


================
@@ -147,9 +147,14 @@ class MessageHandler {
                     void (ThisT::*handler)(const Param &)) {
     notificationHandlers[method] = [method, handler,
                                     thisPtr](llvm::json::Value rawParams) {
-      llvm::Expected<Param> param = parse<Param>(rawParams, method, "request");
-      if (!param)
-        return llvm::consumeError(param.takeError());
+      llvm::Expected<Param> param =
+          parse<Param>(rawParams, method, "notification");
+      if (!param) {
+        return llvm::consumeError(
+            llvm::handleErrors(param.takeError(), [](const LSPError &lspError) {
+              Logger::error(lspError.message.c_str());
----------------
walter-erquinigo wrote:

log an additional error description besides the JSON parsing error, which is not very actionable and doesn't tell the user that the error is when parsing a notification

https://github.com/llvm/llvm-project/pull/89856


More information about the Mlir-commits mailing list