[SourceKit] Fail requests when an error occurs

Previously, requests would fail silently by returning an empty struct
in the response.

With this change, responses will properly report fail with the internal
error.
This commit is contained in:
David Goldman
2019-04-18 11:25:53 -04:00
parent f978cb0ba3
commit 10ecea6269
20 changed files with 291 additions and 223 deletions

View File

@@ -90,6 +90,8 @@ public:
};
struct TestCursorInfo {
// Empty if no error.
std::string Error;
std::string Name;
std::string Typename;
std::string Filename;
@@ -146,7 +148,8 @@ public:
TestCursorInfo TestInfo;
getLang().getCursorInfo(DocName, Offset, 0, false, false, Args,
[&](const CursorInfoData &Info) {
[&](const CursorInfoData &Info, StringRef Error) {
TestInfo.Error = Error;
TestInfo.Name = Info.Name;
TestInfo.Typename = Info.TypeName;
TestInfo.Filename = Info.Filename;