Skip to content

Commit f56e119

Browse files
author
Jan Zahradník
committed
Exceptions => SelfLog
1 parent 4ebc80b commit f56e119

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -364,18 +364,17 @@ internal static MethodInfo SelectConfigurationMethod(IEnumerable<MethodInfo> can
364364
.Where(m => m.Name == name)
365365
.Select(m => $"{m.Name}({string.Join(", ", m.GetParameters().Skip(1).Select(p => p.Name))})")
366366
.ToList();
367-
if (!methodsByName.Any())
368-
throw new MissingMethodException($"Unable to find a method called {name}. Candidate methods are:{Environment.NewLine}{string.Join(Environment.NewLine, candidateMethods)}");
369367

370-
string msg = $"Unable to find a method called {name} "
371-
+ (suppliedArgumentValues.Any()
372-
? "for supplied arguments: " + string.Join(", ", suppliedArgumentValues.Keys)
368+
if (!methodsByName.Any())
369+
SelfLog.WriteLine($"Unable to find a method called {name}. Candidate methods are:{Environment.NewLine}{string.Join(Environment.NewLine, candidateMethods)}");
370+
else
371+
SelfLog.WriteLine($"Unable to find a method called {name} "
372+
+ (suppliedArgumentNames.Any()
373+
? "for supplied arguments: " + string.Join(", ", suppliedArgumentNames)
373374
: "with no supplied arguments")
374375
+ ". Candidate methods are:"
375376
+ Environment.NewLine
376-
+ string.Join(Environment.NewLine, methodsByName);
377-
378-
throw new MissingMethodException(msg);
377+
+ string.Join(Environment.NewLine, methodsByName));
379378
}
380379

381380
return selectedMethod;

0 commit comments

Comments
 (0)