diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Search/SearchService.cs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/slskd/Search/SearchService.cs b/src/slskd/Search/SearchService.cs index ac99ee2e..98001396 100644 --- a/src/slskd/Search/SearchService.cs +++ b/src/slskd/Search/SearchService.cs @@ -311,11 +311,10 @@ namespace slskd.Search { try { - // the only way we should ever get to this point is if we encounter an error sending the search - // request to the server (timeout, cancelled) or hit some highly improbable error within Soulseek.NET, - // potentially OOM or something. in these cases the task will throw and we need to force the - // search record into Errored state. - if (task.IsFaulted) + catch (OperationCanceledException) + { + search.State = SearchStates.Completed | SearchStates.Cancelled; + } { Log.Error(task.Exception, "Failed to execute search for '{Query}' (id: {Id}): {Message}", query, id, task.Exception?.Message ?? "Task completed in Faulted state, but there is no Exception"); search.State = SearchStates.Completed | SearchStates.Errored; |
