Skip to content

Commit

Permalink
improve exception handline
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Jan 31, 2023
1 parent 989e44c commit 9f893fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,12 @@ public void sessionStarted() {
@Override
public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context,
IProgressMonitor monitor) {
CompletableFuture<ICompletionProposal[]> future = CompletableFuture.supplyAsync(() -> {
return lsContentAssistProcessor.computeCompletionProposals(context.getViewer(), context.getInvocationOffset());
});
CompletableFuture<ICompletionProposal[]> future = CompletableFuture.supplyAsync(() ->
lsContentAssistProcessor.computeCompletionProposals(context.getViewer(), context.getInvocationOffset()));

try {
return Arrays.asList(asJavaProposals(future));
} catch (TimeoutException e) {
LanguageServerPlugin.logError(e);
javaCompletionSpecificErrorMessage = createErrorMessage(e);
return Collections.emptyList();
} catch (ExecutionException e) {
} catch (ExecutionException | TimeoutException e) {
LanguageServerPlugin.logError(e);
javaCompletionSpecificErrorMessage = createErrorMessage(e);
return Collections.emptyList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,13 @@ public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
leadingImageWidth = input.getLeadingImageWidth();
jdtHtmlHoverContent = input.getHtml();
}

} catch (InterruptedException | ExecutionException e) {
} catch (ExecutionException e) {
LanguageServerPlugin.logWarning("Javadoc unavailable. Failed to obtain it.", e);
// Return null to let JDT compute the hover using its own Hover Providers
return null;
} catch (InterruptedException e) {
LanguageServerPlugin.logWarning("Javadoc unavailable. Failed to obtain it.", e);
Thread.currentThread().interrupt();
// Return null to let JDT compute the hover using its own Hover Providers
return null;
} catch (TimeoutException e) {
Expand Down

0 comments on commit 9f893fd

Please sign in to comment.