From a4ca259a64d12629d88a1c801c4bc869c8a5d44b Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Thu, 12 Dec 2019 17:25:58 +0100 Subject: [PATCH] Add improved error error for #2141 --- Emby.Server.Implementations/LiveTv/LiveTvManager.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index 2ecf4e1847..ee7db1413d 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -304,9 +304,12 @@ namespace Emby.Server.Implementations.LiveTv } private ILiveTvService GetService(string name) - { - return _services.FirstOrDefault(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase)); - } + => Array.Find(_services, x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase)) + ?? throw new KeyNotFoundException( + string.Format( + CultureInfo.InvariantCulture, + "No service with the name '{0}' can be found.", + name)); private static void Normalize(MediaSourceInfo mediaSource, ILiveTvService service, bool isVideo) {