Skip to content

Commit 447cda1

Browse files
committed
Inside the 'Process' method, a check for the 'err' variable is added to make sure an error is thrown if 'err' is not null. Modify the exception assertion of the 'Rollback_Should_Be_Executed' single test to use 'Assert.ThrowsAsync' to verify whether a 'DtmFailureException' was thrown.
1 parent 0a7c144 commit 447cda1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Dtmworkflow/Workflow.Imp.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ internal async Task<byte[]> Process(WfFunc2 handler, byte[] data)
8181
await this.Submit(res, err, default);
8282
}
8383

84+
if (err != null)
85+
throw err;
86+
8487
return res;
8588
}
8689

tests/Dtmworkflow.Tests/WorkflowHttpTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public async void Rollback_Should_Be_Executed()
208208
wfgt.Register(wfName, handler);
209209
var req = JsonSerializer.Serialize(new { userId = "1", amount = 30 });
210210

211-
var res = await wfgt.Execute(wfName, gid, Encoding.UTF8.GetBytes(req), true);
211+
var res = await Assert.ThrowsAsync<DtmFailureException>(async () => await wfgt.Execute(wfName, gid, Encoding.UTF8.GetBytes(req), true));
212212

213213
func.Verify(x => x.Invoke(It.IsAny<BranchBarrier>()), Times.Once);
214214
}

0 commit comments

Comments
 (0)