mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-19 08:37:23 +01:00
Log exception when (static) mapping file cannot be read (#1202)
This commit is contained in:
@@ -51,10 +51,10 @@ public interface IWireMockLogger
|
||||
/// <summary>
|
||||
/// Writes the message at the Error level using the specified exception.
|
||||
/// </summary>
|
||||
/// <param name="formatString">The format string.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="exception">The exception.</param>
|
||||
[PublicAPI]
|
||||
void Error(string formatString, Exception exception);
|
||||
void Error(string message, Exception exception);
|
||||
|
||||
/// <summary>
|
||||
/// Writes the LogEntryModel (LogRequestModel, LogResponseModel and more).
|
||||
|
||||
@@ -52,9 +52,9 @@ public class WireMockConsoleLogger : IWireMockLogger
|
||||
}
|
||||
|
||||
/// <see cref="IWireMockLogger.Error(string, Exception)"/>
|
||||
public void Error(string formatString, Exception exception)
|
||||
public void Error(string message, Exception exception)
|
||||
{
|
||||
Console.WriteLine(Format("Error", formatString, exception.Message));
|
||||
Console.WriteLine(Format("Error", $"{message} {{0}}", exception.Message));
|
||||
|
||||
if (exception is AggregateException ae)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ public class WireMockNullLogger : IWireMockLogger
|
||||
}
|
||||
|
||||
/// <see cref="IWireMockLogger.Error(string, Exception)"/>
|
||||
public void Error(string formatString, Exception exception)
|
||||
public void Error(string message, Exception exception)
|
||||
{
|
||||
// Log nothing
|
||||
}
|
||||
|
||||
@@ -178,9 +178,9 @@ public partial class WireMockServer
|
||||
{
|
||||
ReadStaticMappingAndAddOrUpdate(filename);
|
||||
}
|
||||
catch
|
||||
catch (Exception exception)
|
||||
{
|
||||
_settings.Logger.Error("Static MappingFile : '{0}' could not be read. This file will be skipped.", filename);
|
||||
_settings.Logger.Error($"Static MappingFile : '{filename}' could not be read. This file will be skipped.", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user