Skip to content

Commit

Permalink
Added inner exception to ConcurrentModificationException thrown by Az…
Browse files Browse the repository at this point in the history
…ureBlobEventStore
  • Loading branch information
stidsborg committed Nov 15, 2023
1 parent 7f0407e commit e85c000
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Cleipnir.ResilientFunctions.Domain.Exceptions;
using System;

namespace Cleipnir.ResilientFunctions.Domain.Exceptions;

public sealed class ConcurrentModificationException : RFunctionException
{
Expand All @@ -9,4 +11,11 @@ public ConcurrentModificationException(FunctionId functionId)
functionId.TypeId,
$"Unable to persist state for '{functionId}' due to concurrent modification"
) => FunctionId = functionId;

public ConcurrentModificationException(FunctionId functionId, Exception innerException)
: base(
functionId.TypeId,
$"Unable to persist state for '{functionId}' due to concurrent modification",
innerException
) => FunctionId = functionId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,14 @@ private async Task<FunctionStatus> AppendOrCreate(FunctionId functionId, string
}
catch (RequestFailedException exception)
{
if (exception.Status == 404) throw new ConcurrentModificationException(functionId);
if (exception.Status == 404) throw new ConcurrentModificationException(functionId, exception);
throw;
}
}
catch (RequestFailedException e)
{
if (e.ErrorCode != "BlobNotFound") throw;
throw new ConcurrentModificationException(functionId);
throw new ConcurrentModificationException(functionId, e);
}
}

Expand Down

0 comments on commit e85c000

Please sign in to comment.