Skip to content

Commit 1e11397

Browse files
committed
Report cancellation of a suspend action as a result of the suspension
Previously, it was handled as an unexpected error.
1 parent 9302839 commit 1e11397

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Rubberduck.Parsing/VBA/ParseCoordinator.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,13 @@ public void SuspendRequested(object sender, RubberduckStatusSuspendParserEventAr
150150
CancellationToken.None);
151151
e.BusyAction.Invoke();
152152
}
153-
catch(Exception ex)
153+
catch (OperationCanceledException ex)
154+
{
155+
e.Result = SuspensionResult.Canceled;
156+
e.EncounteredException = ex;
157+
throw;
158+
}
159+
catch (Exception ex)
154160
{
155161
e.Result = SuspensionResult.UnexpectedError;
156162
e.EncounteredException = ex;

Rubberduck.Parsing/VBA/RubberduckParserState.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ public enum SuspensionResult
8888
/// </summary>
8989
NotEnabled,
9090
/// <summary>
91+
/// The suspend action has thrown an OperationCanceledException.
92+
/// </summary>
93+
Canceled,
94+
/// <summary>
9195
/// An unexpected error; usually indicates a bug in code.
9296
/// </summary>
9397
UnexpectedError

0 commit comments

Comments
 (0)