mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-17 22:19:39 +02:00
Handlebars Extension (#286)
* wip * HandlebarsRegistrationCallback * HandlebarsContextFactoryTests * 1.0.21.0 * fix sonar * LocalFileSystemHandler * readme * Fix System.IO.IOException
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using System.IO;
|
||||
using JetBrains.Annotations;
|
||||
using System.Threading;
|
||||
using JetBrains.Annotations;
|
||||
using WireMock.Handlers;
|
||||
using WireMock.Validation;
|
||||
|
||||
@@ -11,16 +10,19 @@ namespace WireMock.Util
|
||||
private const int NumberOfRetries = 3;
|
||||
private const int DelayOnRetry = 500;
|
||||
|
||||
public static string ReadAllTextWithRetryAndDelay([NotNull] IFileSystemHandler handler, [NotNull] string path)
|
||||
public static bool TryReadMappingFileWithRetryAndDelay([NotNull] IFileSystemHandler handler, [NotNull] string path, out string value)
|
||||
{
|
||||
Check.NotNull(handler, nameof(handler));
|
||||
Check.NotNullOrEmpty(path, nameof(path));
|
||||
|
||||
value = null;
|
||||
|
||||
for (int i = 1; i <= NumberOfRetries; ++i)
|
||||
{
|
||||
try
|
||||
{
|
||||
return handler.ReadMappingFile(path);
|
||||
value = handler.ReadMappingFile(path);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -28,7 +30,7 @@ namespace WireMock.Util
|
||||
}
|
||||
}
|
||||
|
||||
throw new IOException();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user