fix: Better error message when no config files are found

json-serializing-nullable-fields-issue
Robert Dailey 9 months ago
parent 028f9be125
commit e6924c10e4

@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Reduce the time it takes to clone the config and trash repositories by performing shallow clones
(#201).
### Fixed
- Better error message to console when no configuration files are found.
## [5.2.0] - 2023-08-06
### Added

@ -4,6 +4,7 @@ using JetBrains.Annotations;
using Recyclarr.Cli.Console.Helpers;
using Recyclarr.Cli.Processors.Config;
using Recyclarr.TrashLib.Config.Listers;
using Recyclarr.TrashLib.Config.Parsing.ErrorHandling;
using Recyclarr.TrashLib.ExceptionTypes;
using Spectre.Console.Cli;
@ -45,6 +46,10 @@ public class ConfigListCommand : AsyncCommand<ConfigListCommand.CliSettings>
return 1;
}
catch (NoConfigurationFilesException)
{
_log.Error("No configuration files found");
}
return 0;
}

@ -6,6 +6,7 @@ using Recyclarr.Common.Extensions;
using Recyclarr.TrashLib.Compatibility;
using Recyclarr.TrashLib.Config;
using Recyclarr.TrashLib.Config.Parsing;
using Recyclarr.TrashLib.Config.Parsing.ErrorHandling;
using Recyclarr.TrashLib.Config.Services;
using Recyclarr.TrashLib.Http;
using Recyclarr.TrashLib.Repo.VersionControl;
@ -129,6 +130,10 @@ public class SyncProcessor : ISyncProcessor
break;
case NoConfigurationFilesException:
_log.Error("No configuration files found");
break;
default:
throw e;
}
@ -143,7 +148,7 @@ public class SyncProcessor : ISyncProcessor
}
return response
.Select(x => (string)x.errorMessage)
.Select(x => (string) x.errorMessage)
.NotNull(x => !string.IsNullOrEmpty(x))
.ToList();
}

@ -1,17 +1,5 @@
using System.Runtime.Serialization;
namespace Recyclarr.TrashLib.Config.Parsing.ErrorHandling;
[Serializable]
public class NoConfigurationFilesException : Exception
{
public NoConfigurationFilesException()
: base("No configuration YAML files found")
{
}
protected NoConfigurationFilesException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}

Loading…
Cancel
Save