Skip to content

Commit 7562444

Browse files
Merge pull request #1708 from VictoriousRaptor/FixShortcutException
Catch exceptions during shortcut expansion
2 parents 6607acb + cb44966 commit 7562444

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,16 @@ private Query ConstructQuery(string queryText, IEnumerable<CustomShortcutModel>
780780
{
781781
foreach (var shortcut in builtInShortcuts)
782782
{
783-
queryBuilder.Replace(shortcut.Key, shortcut.Expand());
784-
queryBuilderTmp.Replace(shortcut.Key, shortcut.Expand());
783+
try
784+
{
785+
var expansion = shortcut.Expand();
786+
queryBuilder.Replace(shortcut.Key, expansion);
787+
queryBuilderTmp.Replace(shortcut.Key, expansion);
788+
}
789+
catch (Exception e)
790+
{
791+
Log.Exception($"{nameof(MainViewModel)}.{nameof(ConstructQuery)}|Error when expanding shortcut {shortcut.Key}", e);
792+
}
785793
}
786794
});
787795

0 commit comments

Comments
 (0)