From 12d230dcda07a372d9d0117782a4e4649ec36a90 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 5 Nov 2021 18:23:00 +0800 Subject: [PATCH] Catch errors --- TVRename/ItemsAndActions/ItemMissing.cs | 10 +++++++++- TVRename/Sources/TMDB/LocalCache.cs | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/TVRename/ItemsAndActions/ItemMissing.cs b/TVRename/ItemsAndActions/ItemMissing.cs index be71f4e6..49d88a71 100644 --- a/TVRename/ItemsAndActions/ItemMissing.cs +++ b/TVRename/ItemsAndActions/ItemMissing.cs @@ -11,6 +11,7 @@ namespace TVRename { using Alphaleonis.Win32.Filesystem; + using System; public abstract class ItemMissing : Item { @@ -22,7 +23,14 @@ public abstract class ItemMissing : Item [NotNull] public override string ScanListViewGroup => "lvgActionMissing"; public override string DestinationFolder => Folder; - public override string TargetFolder => new FileInfo(TheFileNoExt).DirectoryName; + public override string TargetFolder + { + get + { + try { return new FileInfo(TheFileNoExt).DirectoryName; } + catch (NotSupportedException nse) { return string.Empty; } + } + } public override int IconNumber => 1; public abstract bool DoRename { get; } public abstract MediaConfiguration Show { get; } diff --git a/TVRename/Sources/TMDB/LocalCache.cs b/TVRename/Sources/TMDB/LocalCache.cs index f2b26ea4..ecf1a268 100644 --- a/TVRename/Sources/TMDB/LocalCache.cs +++ b/TVRename/Sources/TMDB/LocalCache.cs @@ -22,6 +22,7 @@ using TMDbLib.Objects.Trending; using TMDbLib.Objects.TvShows; using TVRename.Forms; +using static TVRename.TMDB.API; using Cast = TMDbLib.Objects.Movies.Cast; using FileInfo = Alphaleonis.Win32.Filesystem.FileInfo; @@ -341,6 +342,12 @@ public bool GetUpdates(bool showErrorMsgBox, CancellationToken cts, [NotNull] IE LOGGER.Warn(LastErrorMessage); return false; } + catch (TooManyCallsException tce) + { + LastErrorMessage = "Too Many Calls Made - cancelled"; + LOGGER.Warn(LastErrorMessage); + return false; + } finally { SayNothing();