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

Brian Gesiak llvmlistbot at llvm.org
Wed Apr 24 10:39:56 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}",
----------------
modocache wrote:

So, just to be clear, that would result in:

```
E[12:57:59.961] Error when parsing the notification JSON packet: failed to decode invalid-params-notification notification: missing value at (root).uri
```

Which mentions "notification" twice. Personally I think that's equally informative as the current patch:

```
E[12:57:59.961] JSON parsing error: failed to decode invalid-params-notification notification: missing value at (root).uri
```

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


More information about the Mlir-commits mailing list