Skip to content

Commit

Permalink
Adding more logs Gen1 Bundles.
Browse files Browse the repository at this point in the history
  • Loading branch information
fhibf committed Oct 23, 2023
1 parent da58301 commit 4fc2303
Showing 1 changed file with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,25 @@ public async Task<UpsertOutcome> UpsertAsync(ResourceWrapperOperation resource,
}
else
{
return await InternalUpsertAsync(
resource.Wrapper,
resource.WeakETag,
resource.AllowCreate,
resource.KeepHistory,
cancellationToken,
resource.RequireETagOnUpdate);
try
{
return await InternalUpsertAsync(
resource.Wrapper,
resource.WeakETag,
resource.AllowCreate,
resource.KeepHistory,
cancellationToken,
resource.RequireETagOnUpdate);
}
catch (FhirException fhirException)
{
// This block catches only FhirExceptions. FhirException can be thrown by the data store layer
// in different situations, like: Failed pre-conditions, bad requests, resource not found, etc.

_logger.LogInformation("Upserting failed. {ExceptionType}: {ExceptionMessage}", fhirException.GetType().ToString(), fhirException.Message);

throw;
}
}
}

Expand All @@ -262,7 +274,7 @@ private async Task<UpsertOutcome> InternalUpsertAsync(
var partitionKey = new PartitionKey(cosmosWrapper.PartitionKey);
AsyncPolicy retryPolicy = _retryExceptionPolicyFactory.RetryPolicy;

_logger.LogDebug("Upserting {ResourceType}/{ResourceId}, ETag: \"{Tag}\", AllowCreate: {AllowCreate}, KeepHistory: {KeepHistory}", resource.ResourceTypeName, resource.ResourceId, weakETag?.VersionId, allowCreate, keepHistory);
_logger.LogInformation("Upserting {ResourceType}/{ResourceId}, ETag: \"{Tag}\", AllowCreate: {AllowCreate}, KeepHistory: {KeepHistory}", resource.ResourceTypeName, resource.ResourceId, weakETag?.VersionId, allowCreate, keepHistory);

if (weakETag == null && allowCreate && !cosmosWrapper.IsDeleted)
{
Expand Down

0 comments on commit 4fc2303

Please # to comment.