Fix remaining technical debt bugs

- Bug-001: Add null check for SingleOrDefault() in TorrentRssParser
- Bug-006: Replace generic Exception with PathCombinationException in OsPath
- Bug-006: Replace generic Exception with NotSupportedException in IMDbListRequestGenerator
This commit is contained in:
admin 2025-12-19 09:05:54 -06:00
parent d82f07e872
commit f435f38a27
4 changed files with 23 additions and 3 deletions

View file

@ -421,7 +421,7 @@ public bool Equals(OsPath other, bool ignoreTrailingSlash)
{
if (left.Kind != right.Kind && right.Kind != OsPathKind.Unknown)
{
throw new Exception(string.Format("Cannot combine OsPaths of different platforms ('{0}' + '{1}')", left, right));
throw new PathCombinationException("Cannot combine OsPaths of different platforms ('{0}' + '{1}')", left, right);
}
if (right.IsEmpty)

View file

@ -0,0 +1,17 @@
using NzbDrone.Common.Exceptions;
namespace NzbDrone.Common.Disk
{
public class PathCombinationException : NzbDroneException
{
public PathCombinationException(string message, params object[] args)
: base(message, args)
{
}
public PathCombinationException(string message)
: base(message)
{
}
}
}

View file

@ -14,7 +14,7 @@ protected override HttpRequest GetHttpRequest()
// Use IMDb list Export for user lists to bypass RadarrAPI caching
if (Settings.ListId.StartsWith("ls", StringComparison.OrdinalIgnoreCase))
{
throw new Exception("IMDb lists of the form 'ls12345678' are no longer supported. Feel free to remove this list after you review your Clean Library Level.");
throw new NotSupportedException("IMDb lists of the form 'ls12345678' are no longer supported. Feel free to remove this list after you review your Clean Library Level.");
}
var request = RequestBuilder.Create()

View file

@ -168,7 +168,10 @@ protected virtual string GetMagnetUrl(XElement item)
if (PeersElementName.IsNotNullOrWhiteSpace())
{
var itempeers = item.FindDecendants(PeersElementName).SingleOrDefault();
return int.Parse(itempeers.Value);
if (itempeers != null)
{
return int.Parse(itempeers.Value);
}
}
return null;