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

Brian Gesiak llvmlistbot at llvm.org
Wed Apr 24 10:04:16 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());
----------------
modocache wrote:

I had thought of that, but, for what it's worth, this is what's printed in this patch:

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

I do think I can preface it with something, as in `JSON parsing error: failed to decode invalid-params-notification notification: missing value at (root).uri`. Personally I feel "JSON parsing" is a little more understandable than "decode."

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


More information about the Mlir-commits mailing list