mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -834,7 +834,8 @@ void SwiftLangSupport::editorOpenHeaderInterface(EditorConsumer &Consumer,
|
||||
|
||||
void SwiftLangSupport::findInterfaceDocument(StringRef ModuleName,
|
||||
ArrayRef<const char *> Args,
|
||||
std::function<void(const InterfaceDocInfo &)> Receiver) {
|
||||
std::function<void(const InterfaceDocInfo &,
|
||||
StringRef Error)> Receiver) {
|
||||
InterfaceDocInfo Info;
|
||||
|
||||
CompilerInstance CI;
|
||||
@@ -846,8 +847,7 @@ void SwiftLangSupport::findInterfaceDocument(StringRef ModuleName,
|
||||
std::string Error;
|
||||
if (getASTManager()->initCompilerInvocation(Invocation, Args, CI.getDiags(),
|
||||
StringRef(), Error)) {
|
||||
Info.Error = Error;
|
||||
return Receiver(Info);
|
||||
return Receiver({}, Error);
|
||||
}
|
||||
|
||||
if (auto IFaceGenRef = IFaceGenContexts.find(ModuleName, Invocation))
|
||||
@@ -905,5 +905,5 @@ void SwiftLangSupport::findInterfaceDocument(StringRef ModuleName,
|
||||
}
|
||||
Info.CompilerArgs = NewArgs;
|
||||
|
||||
return Receiver(Info);
|
||||
return Receiver(Info, "");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user