[PATCH] D85502: [clangd] Add more error details on the remote index server side

Kirill Bobyrev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 9 13:13:25 PDT 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG836f937a1f11: [clangd] Add more error details on the remote index server side (authored by kbobyrev).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85502/new/

https://reviews.llvm.org/D85502

Files:
  clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp


Index: clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
===================================================================
--- clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
+++ clang-tools-extra/clangd/index/remote/marshalling/Marshalling.cpp
@@ -23,6 +23,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/StringSaver.h"
 
@@ -303,7 +304,8 @@
   if (RelativePath.empty())
     return makeStringError("Empty relative path.");
   if (llvm::sys::path::is_absolute(RelativePath))
-    return makeStringError("RelativePath is absolute.");
+    return makeStringError(
+        llvm::formatv("RelativePath '{0}' is absolute.", RelativePath).str());
   llvm::SmallString<256> FullPath = llvm::StringRef(*LocalIndexRoot);
   llvm::sys::path::append(FullPath, RelativePath);
   auto Result = URI::createFile(FullPath);
@@ -316,10 +318,16 @@
   if (!ParsedURI)
     return ParsedURI.takeError();
   if (ParsedURI->scheme() != "file")
-    return makeStringError("Can not use URI schemes other than file.");
+    return makeStringError(
+        llvm::formatv("Can not use URI schemes other than file, given: '{0}'.",
+                      URI)
+            .str());
   llvm::SmallString<256> Result = ParsedURI->body();
   if (!llvm::sys::path::replace_path_prefix(Result, *RemoteIndexRoot, ""))
-    return makeStringError("File path doesn't start with RemoteIndexRoot.");
+    return makeStringError(
+        llvm::formatv("File path '{0}' doesn't start with '{1}'.", Result.str(),
+                      *RemoteIndexRoot)
+            .str());
   // Make sure the result has UNIX slashes.
   return llvm::sys::path::convert_to_slash(Result,
                                            llvm::sys::path::Style::posix);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85502.284231.patch
Type: text/x-patch
Size: 1904 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200809/451a2358/attachment-0001.bin>


More information about the cfe-commits mailing list