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

Walter Erquinigo llvmlistbot at llvm.org
Wed Apr 24 10:19:20 PDT 2024


================
@@ -147,9 +147,15 @@ 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("JSON parsing error: {0}",
----------------
walter-erquinigo wrote:

you could also be more specific, e.g.

```
Error when parsing the notification JSON packet: ...
```

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


More information about the Mlir-commits mailing list