mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-01 15:13:33 +02:00
Log exception when (static) mapping file cannot be read (#1202)
This commit is contained in:
@@ -51,10 +51,10 @@ public interface IWireMockLogger
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the message at the Error level using the specified exception.
|
/// Writes the message at the Error level using the specified exception.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="formatString">The format string.</param>
|
/// <param name="message">The message.</param>
|
||||||
/// <param name="exception">The exception.</param>
|
/// <param name="exception">The exception.</param>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
void Error(string formatString, Exception exception);
|
void Error(string message, Exception exception);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the LogEntryModel (LogRequestModel, LogResponseModel and more).
|
/// Writes the LogEntryModel (LogRequestModel, LogResponseModel and more).
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ public class WireMockConsoleLogger : IWireMockLogger
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <see cref="IWireMockLogger.Error(string, Exception)"/>
|
/// <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)
|
if (exception is AggregateException ae)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class WireMockNullLogger : IWireMockLogger
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <see cref="IWireMockLogger.Error(string, Exception)"/>
|
/// <see cref="IWireMockLogger.Error(string, Exception)"/>
|
||||||
public void Error(string formatString, Exception exception)
|
public void Error(string message, Exception exception)
|
||||||
{
|
{
|
||||||
// Log nothing
|
// Log nothing
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,9 +178,9 @@ public partial class WireMockServer
|
|||||||
{
|
{
|
||||||
ReadStaticMappingAndAddOrUpdate(filename);
|
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