Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add exception to an error message #477

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,20 @@ private async Task<bool> Synchronize(IEnumerable<ElasticsearchSyncRecord> elasti

if (elasticsearchSyncOperation == ElasticsearchSyncOperation.Delete)
{
var result = await esProvider.DeleteRangeOfEntitiesByIdsAsync(ids).ConfigureAwait(false);
try
{
var result = await esProvider.DeleteRangeOfEntitiesByIdsAsync(ids).ConfigureAwait(false);

if (result == Result.Error)
if (result == Result.Error)
{
logger.LogError($"Error happend while trying to delete indexes in Elasticsearch.");
return false;
}
}
catch (Exception ex)
{
logger.LogError($"Error happend while trying to delete indexes in Elasticsearch.");
return false;
logger.LogError($"Exception information: {ex}");
throw;
}
}
else
Expand All @@ -146,12 +154,20 @@ private async Task<bool> Synchronize(IEnumerable<ElasticsearchSyncRecord> elasti

var sourse = mapper.Map<List<WorkshopES>>(workshops);

var result = await esProvider.IndexAll(sourse).ConfigureAwait(false);
try
{
var result = await esProvider.IndexAll(sourse).ConfigureAwait(false);

if (result == Result.Error)
if (result == Result.Error)
{
logger.LogError($"Error happend while trying to update indexes in Elasticsearch.");
return false;
}
}
catch (Exception ex)
{
logger.LogError($"Error happend while trying to update indexes in Elasticsearch.");
return false;
logger.LogError($"Exception information: {ex}");
throw;
}
}

Expand Down