Skip to content

Commit

Permalink
Don't catch the cancellation exception
Browse files Browse the repository at this point in the history
See microsoft/vscode-maven#47 (comment)

Signed-off-by: azerr <azerr@redhat.com>
  • Loading branch information
azerr authored and datho7561 committed Jan 7, 2021
1 parent c1f855c commit 0d812fb
Showing 1 changed file with 21 additions and 5 deletions.
Expand Up @@ -18,6 +18,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CancellationException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
Expand Down Expand Up @@ -626,8 +627,11 @@ private void collectOpenTagSuggestions(boolean hasOpenBracket, Range replaceRang
for (ICompletionParticipant participant : getCompletionParticipants()) {
try {
participant.onTagOpen(completionRequest, completionResponse);
} catch (CancellationException e) {
throw e;
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "While performing ICompletionParticipant#onTagOpen for participant '" + participant.getClass().getName() + "'.", e);
LOGGER.log(Level.SEVERE, "While performing ICompletionParticipant#onTagOpen for participant '"
+ participant.getClass().getName() + "'.", e);
}
}
DOMElement parentNode = completionRequest.getParentElement();
Expand Down Expand Up @@ -762,6 +766,8 @@ private void collectInsideContent(CompletionRequest request, CompletionResponse
for (ICompletionParticipant participant : getCompletionParticipants()) {
try {
participant.onXMLContent(request, response);
} catch (CancellationException e) {
throw e;
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "While performing ICompletionParticipant#onXMLContent for participant '"
+ participant.getClass().getName() + "'.", e);
Expand Down Expand Up @@ -858,16 +864,18 @@ private void collectAttributeNameSuggestions(int nameStart, int nameEnd, Complet
for (ICompletionParticipant participant : getCompletionParticipants()) {
try {
participant.onAttributeName(generateValue, completionRequest, completionResponse);
} catch (CancellationException e) {
throw e;
} catch (Exception e) {
LOGGER.log(Level.SEVERE,
"While performing ICompletionParticipant#onAttributeName for participant '"
+ participant.getClass().getName() + "'.",
e);
LOGGER.log(Level.SEVERE, "While performing ICompletionParticipant#onAttributeName for participant '"
+ participant.getClass().getName() + "'.", e);
}
}
} catch (BadLocationException e) {
LOGGER.log(Level.SEVERE, "While performing Completions, getReplaceRange() was given a bad Offset location",
e);
} catch (CancellationException e) {
throw e;
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "While performing ICompletionParticipant#onAttributeName", e);
}
Expand Down Expand Up @@ -909,6 +917,8 @@ private void collectAttributeValueSuggestions(int valueStart, int valueEnd, Comp
for (ICompletionParticipant participant : completionParticipants) {
try {
participant.onAttributeValue(valuePrefix, completionRequest, completionResponse);
} catch (CancellationException e) {
throw e;
} catch (Exception e) {
LOGGER.log(Level.SEVERE,
"While performing ICompletionParticipant#onAttributeValue for participant '"
Expand All @@ -919,6 +929,8 @@ private void collectAttributeValueSuggestions(int valueStart, int valueEnd, Comp
} catch (BadLocationException e) {
LOGGER.log(Level.SEVERE,
"While performing Completions, getReplaceRange() was given a bad Offset location", e);
} catch (CancellationException e) {
throw e;
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "While performing ICompletionParticipant#onAttributeValue", e);
}
Expand Down Expand Up @@ -953,6 +965,8 @@ private void collectDTDSystemIdSuggestions(int valueStart, int valueEnd, Complet
for (ICompletionParticipant participant : completionParticipants) {
try {
participant.onDTDSystemId(valuePrefix, completionRequest, completionResponse);
} catch (CancellationException e) {
throw e;
} catch (Exception e) {
LOGGER.log(Level.SEVERE,
"While performing ICompletionParticipant#onDTDSystemId for participant '"
Expand All @@ -963,6 +977,8 @@ private void collectDTDSystemIdSuggestions(int valueStart, int valueEnd, Complet
} catch (BadLocationException e) {
LOGGER.log(Level.SEVERE,
"While performing Completions, getReplaceRange() was given a bad Offset location", e);
} catch (CancellationException e) {
throw e;
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "While performing ICompletionParticipant#onDTDSystemId", e);
}
Expand Down

0 comments on commit 0d812fb

Please sign in to comment.