Author: Sam McCall
Date: 2020-09-24T01:51:37+02:00
New Revision: 2bd5e3fb3cc032f90447067d38c48c75b23f32c5

URL: 
https://github.com/llvm/llvm-project/commit/2bd5e3fb3cc032f90447067d38c48c75b23f32c5
DIFF: 
https://github.com/llvm/llvm-project/commit/2bd5e3fb3cc032f90447067d38c48c75b23f32c5.diff

LOG: [clangd] Improve bad-RPC-payload error messages slightly

Added: 
    

Modified: 
    clang-tools-extra/clangd/ClangdLSPServer.h

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/ClangdLSPServer.h 
b/clang-tools-extra/clangd/ClangdLSPServer.h
index 7815d4e46795..ab34ea7be748 100644
--- a/clang-tools-extra/clangd/ClangdLSPServer.h
+++ b/clang-tools-extra/clangd/ClangdLSPServer.h
@@ -187,7 +187,8 @@ class ClangdLSPServer : private ClangdServer::Callbacks {
     T Result;
     llvm::json::Path::Root Root;
     if (!fromJSON(Raw, Result, Root)) {
-      elog("Failed to decode {0} {1}", PayloadName, PayloadKind);
+      elog("Failed to decode {0} {1}: {2}", PayloadName, PayloadKind,
+           Root.getError());
       // Dump the relevant parts of the broken message.
       std::string Context;
       llvm::raw_string_ostream OS(Context);
@@ -195,7 +196,8 @@ class ClangdLSPServer : private ClangdServer::Callbacks {
       vlog("{0}", OS.str());
       // Report the error (e.g. to the client).
       return llvm::make_error<LSPError>(
-          llvm::formatv("failed to decode {0} {1}", PayloadName, PayloadKind),
+          llvm::formatv("failed to decode {0} {1}: {2}", PayloadName,
+                        PayloadKind, fmt_consume(Root.getError())),
           ErrorCode::InvalidParams);
     }
     return std::move(Result);


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to