Replacing static names in exception messages with nameof literal

This commit is contained in:
Florian Zevedei 2023-09-29 18:26:39 +02:00
parent 788f935c02
commit b278015dd4
6 changed files with 6 additions and 6 deletions

View File

@ -31,7 +31,7 @@ namespace TelegramBotBase.Extensions.Serializer.Database.MSSQL
if (FallbackStateForm != null && !FallbackStateForm.IsSubclassOf(typeof(FormBase)))
{
throw new ArgumentException("FallbackStateForm is not a subclass of FormBase");
throw new ArgumentException($"{nameof(FallbackStateForm)} is not a subclass of FormBase");
}
}

View File

@ -12,7 +12,7 @@ public class DefaultStartFormFactory : IStartFormFactory
{
if (!typeof(FormBase).IsAssignableFrom(startFormClass))
{
throw new ArgumentException("startFormClass argument must be a FormBase type");
throw new ArgumentException($"{nameof(startFormClass)} argument must be a {nameof(FormBase)} type");
}
_startFormClass = startFormClass;

View File

@ -14,7 +14,7 @@ public class ServiceProviderStartFormFactory : IStartFormFactory
{
if (!typeof(FormBase).IsAssignableFrom(startFormClass))
{
throw new ArgumentException("startFormClass argument must be a FormBase type");
throw new ArgumentException($"{nameof(startFormClass)} argument must be a {nameof(FormBase)} type");
}
_startFormClass = startFormClass;

View File

@ -29,7 +29,7 @@ public class JsonStateMachine : IStateMachine
if (FallbackStateForm != null && !FallbackStateForm.IsSubclassOf(typeof(FormBase)))
{
throw new ArgumentException("FallbackStateForm is not a subclass of FormBase");
throw new ArgumentException($"{nameof(FallbackStateForm)} is not a subclass of {nameof(FormBase)}");
}
FilePath = file ?? throw new ArgumentNullException(nameof(file));

View File

@ -30,7 +30,7 @@ public class SimpleJsonStateMachine : IStateMachine
if (FallbackStateForm != null && !FallbackStateForm.IsSubclassOf(typeof(FormBase)))
{
throw new ArgumentException("FallbackStateForm is not a subclass of FormBase");
throw new ArgumentException($"{nameof(FallbackStateForm)} is not a subclass of {nameof(FormBase)}");
}
FilePath = file ?? throw new ArgumentNullException(nameof(file));

View File

@ -27,7 +27,7 @@ public class XmlStateMachine : IStateMachine
if (FallbackStateForm != null && !FallbackStateForm.IsSubclassOf(typeof(FormBase)))
{
throw new ArgumentException("FallbackStateForm is not a subclass of FormBase");
throw new ArgumentException($"{nameof(FallbackStateForm)} is not a subclass of {nameof(FormBase)}");
}
FilePath = file ?? throw new ArgumentNullException(nameof(file));