Replace InvalidOperationException with custom config exception
Refactored DbModelOptions and EntityBaseOptions to throw DbModelConfigurationException instead of InvalidOperationException for configuration errors. Added necessary using directives for the new exception type to improve error clarity and specificity.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using ReC.Domain.Attributes;
|
||||
using ReC.Infrastructure.Exceptions;
|
||||
|
||||
namespace ReC.Infrastructure.Options.Shared;
|
||||
|
||||
@@ -15,7 +16,7 @@ public record EntityBaseOptions()
|
||||
var missingProperties = propertyNames.Except(PropertyNames).ToList();
|
||||
|
||||
if (missingProperties.Count != 0)
|
||||
throw new InvalidOperationException($"The following properties are not configured: {string.Join(", ", missingProperties)}");
|
||||
throw new DbModelConfigurationException($"The following properties are not configured: {string.Join(", ", missingProperties)}");
|
||||
}
|
||||
|
||||
public void EnsureProperties(params string[] propertyNames)
|
||||
|
||||
Reference in New Issue
Block a user