You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
856 B
32 lines
856 B
using YamlDotNet.Core;
|
|
|
|
namespace Recyclarr.Settings;
|
|
|
|
public static class SettingsContextualMessages
|
|
{
|
|
public static string? GetContextualErrorFromException(YamlException e)
|
|
{
|
|
return LookupMessage(e.Message) ?? LookupMessage(e.InnerException?.Message);
|
|
}
|
|
|
|
private static string? LookupMessage(string? msg)
|
|
{
|
|
if (msg is null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
if (msg.Contains(
|
|
"Property 'repository' not found on type " +
|
|
$"'{typeof(SettingsValues).FullName}'"))
|
|
{
|
|
return
|
|
"Usage of 'repository' setting is no " +
|
|
"longer supported. Use 'trash_guides' under 'repositories' instead." +
|
|
"See: https://recyclarr.dev/wiki/upgrade-guide/v5.0/#settings-repository-changes";
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|