Add exception message to logging when mapping fails due to an exception.

This commit is contained in:
JvE-iO
2025-01-29 12:54:46 +01:00
committed by GitHub
parent f5fe51e227
commit eb7cf46c95

View File

@@ -224,7 +224,7 @@ namespace WireMock.Owin
} }
catch (Exception ex) catch (Exception ex)
{ {
_options.Logger.Error("HttpStatusCode set to 404 : No matching mapping found", ex); _options.Logger.Error("HttpStatusCode set to 404 : 'No matching mapping found', due to exception '{0}'", ex);
var notFoundResponse = ResponseMessageBuilder.Create(HttpStatusCode.NotFound, WireMockConstants.NoMatchingFound); var notFoundResponse = ResponseMessageBuilder.Create(HttpStatusCode.NotFound, WireMockConstants.NoMatchingFound);
await _responseMapper.MapAsync(notFoundResponse, ctx.Response).ConfigureAwait(false); await _responseMapper.MapAsync(notFoundResponse, ctx.Response).ConfigureAwait(false);