diff --git a/src/Recyclarr.Cli/Console/Commands/DeleteCustomFormatsCommand.cs b/src/Recyclarr.Cli/Console/Commands/DeleteCustomFormatsCommand.cs index 13b81479..a3ce5f93 100644 --- a/src/Recyclarr.Cli/Console/Commands/DeleteCustomFormatsCommand.cs +++ b/src/Recyclarr.Cli/Console/Commands/DeleteCustomFormatsCommand.cs @@ -61,7 +61,12 @@ public class DeleteCustomFormatsCommand : AsyncCommand HandleException(Exception sourceException) { switch (sourceException) { @@ -65,9 +65,10 @@ public class ConsoleExceptionHandler _log.Error(e.Message); break; - // This handles non-deterministic/unexpected exceptions. default: - throw sourceException; + return false; } + + return true; } } diff --git a/src/Recyclarr.Cli/Processors/FatalException.cs b/src/Recyclarr.Cli/Processors/FatalException.cs index 3d249846..95e69a03 100644 --- a/src/Recyclarr.Cli/Processors/FatalException.cs +++ b/src/Recyclarr.Cli/Processors/FatalException.cs @@ -6,8 +6,8 @@ namespace Recyclarr.Cli.Processors; [Serializable] public class FatalException : Exception { - public FatalException(string? message) - : base(message) + public FatalException(string? message, Exception? innerException = null) + : base(message, innerException) { } diff --git a/src/Recyclarr.Cli/Processors/Sync/SyncProcessor.cs b/src/Recyclarr.Cli/Processors/Sync/SyncProcessor.cs index c8cd6a02..d05c9254 100644 --- a/src/Recyclarr.Cli/Processors/Sync/SyncProcessor.cs +++ b/src/Recyclarr.Cli/Processors/Sync/SyncProcessor.cs @@ -51,7 +51,12 @@ public class SyncProcessor : ISyncProcessor } catch (Exception e) { - await _exceptionHandler.HandleException(e); + if (!await _exceptionHandler.HandleException(e)) + { + // This means we didn't handle the exception; rethrow it. + throw; + } + failureDetected = true; } @@ -73,7 +78,12 @@ public class SyncProcessor : ISyncProcessor } catch (Exception e) { - await _exceptionHandler.HandleException(e); + if (!await _exceptionHandler.HandleException(e)) + { + // This means we didn't handle the exception; rethrow it. + throw; + } + failureDetected = true; } }