Skip to content

Commit c926d73

Browse files
committed
catch & log AC handler exceptions.
1 parent 1cdcfe6 commit c926d73

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

Rubberduck.Core/AutoComplete/Service/AutoCompleteService.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,31 @@ private void HandleKeyDown(object sender, AutoCompleteEventArgs e)
134134
}
135135

136136
foreach (var handler in _handlers)
137+
{
138+
if (TryHandle(e, handler))
139+
{
140+
return;
141+
}
142+
}
143+
}
144+
145+
private bool TryHandle(AutoCompleteEventArgs e, AutoCompleteHandlerBase handler)
146+
{
147+
try
137148
{
138149
if (!handler.Handle(e, _settings, out _))
139150
{
140-
continue;
151+
return false;
141152
}
142153

143154
e.Handled = true;
144-
return;
155+
return true;
156+
157+
}
158+
catch (Exception exception)
159+
{
160+
Logger.Error(exception);
161+
return false;
145162
}
146163
}
147164

0 commit comments

Comments
 (0)