Skip to content

Commit 5e6d67d

Browse files
committed
verbiage and naming feedback
1 parent 36df0a6 commit 5e6d67d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/Serilog.Settings.Configuration/Settings/Configuration/ConfigurationReader.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,14 @@ IConfigurationArgumentValue GetArgumentValue(IConfigurationSection argumentSecti
222222
{
223223
IConfigurationArgumentValue argumentValue;
224224

225+
// Reject configurations where an element has both scalar and complex
226+
// values as a result of reading multiple configuration sources.
225227
if (argumentSection.Value != null && argumentSection.GetChildren().Any())
226-
throw new InvalidOperationException($"Combined configuration sources must result in a discrete value (string, int, etc.) or complex value (section, list, etc.), not both. Argument: {argumentSection.Path}");
228+
throw new InvalidOperationException(
229+
$"The value for the argument {argumentSection.Path} is assigned different value " +
230+
"types in more than one configuration source. Ensure all configurations consistently " +
231+
"use either a scalar (int, string, boolean) or a complex (array, section, list, " +
232+
"POCO, etc.) type for this argument value.");
227233

228234
if (argumentSection.Value != null)
229235
{

test/Serilog.Settings.Configuration.Tests/ConfigurationSettingsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ public void WriteToSubLoggerWithLevelSwitchIsSupported()
562562

563563
[Trait("Bugfix", "#103")]
564564
[Fact]
565-
public void MultipleArgumentValuesThrowsInvalidOperationException()
565+
public void InconsistentComplexVsScalarArgumentValuesThrowsIOE()
566566
{
567567
var jsonDiscreteValue = @"{
568568
""Serilog"": {

0 commit comments

Comments
 (0)