|
21 | 21 | use Temporal\Exception\Client\ActivityCanceledException; |
22 | 22 | use Temporal\Exception\Client\ActivityCompletionException; |
23 | 23 | use Temporal\Exception\Client\ActivityPausedException; |
| 24 | +use Temporal\Exception\Client\ActivityResetException; |
24 | 25 | use Temporal\Exception\Client\ServiceClientException; |
25 | 26 | use Temporal\Interceptor\HeaderInterface; |
26 | 27 | use Temporal\Internal\Interceptor\HeaderCarrier; |
@@ -129,16 +130,20 @@ public function heartbeat(mixed $details): void |
129 | 130 |
|
130 | 131 | $cancelled = (bool) ($response['canceled'] ?? false); |
131 | 132 | $paused = (bool) ($response['paused'] ?? false); |
| 133 | + $reset = (bool) ($response['reset'] ?? false); |
132 | 134 |
|
133 | | - if ($cancelled || $paused) { |
| 135 | + if ($cancelled || $paused || $reset) { |
134 | 136 | $this->cancellationDetails ??= new ActivityCancellationDetails( |
135 | 137 | cancelRequested: $cancelled, |
136 | 138 | paused: $paused, |
| 139 | + reset: $reset, |
137 | 140 | ); |
138 | 141 |
|
139 | | - throw $cancelled |
140 | | - ? ActivityCanceledException::fromActivityInfo($this->info) |
141 | | - : ActivityPausedException::fromActivityInfo($this->info); |
| 142 | + throw match (true) { |
| 143 | + $cancelled => ActivityCanceledException::fromActivityInfo($this->info), |
| 144 | + $paused => ActivityPausedException::fromActivityInfo($this->info), |
| 145 | + $reset => ActivityResetException::fromActivityInfo($this->info), |
| 146 | + }; |
142 | 147 | } |
143 | 148 | } catch (ServiceClientException $e) { |
144 | 149 | throw ActivityCompletionException::fromActivityInfo($this->info, $e); |
|
0 commit comments