Log exception when (static) mapping file cannot be read (#1202)

This commit is contained in:
Stef Heyenrath
2024-10-29 19:52:31 +01:00
committed by GitHub
parent 214fb539ec
commit 3693d6a676
4 changed files with 7 additions and 7 deletions

View File

@@ -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).

View File

@@ -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)
{ {

View File

@@ -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
} }

View File

@@ -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);
} }
} }
} }