@rivetkit/workflow-engine 2.3.0-rc.5 → 2.3.0-rc.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2201,7 +2201,7 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
2201
2201
  }
2202
2202
  const maxRetries2 = config2.maxRetries ?? DEFAULT_MAX_RETRIES;
2203
2203
  if (metadata2.attempts > maxRetries2) {
2204
- const lastError = stepData.error ?? metadata2.error;
2204
+ const lastError = metadata2.error;
2205
2205
  const exhaustedError = new StepExhaustedError(
2206
2206
  config2.name,
2207
2207
  lastError
@@ -2290,14 +2290,13 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
2290
2290
  });
2291
2291
  return output;
2292
2292
  } catch (error) {
2293
+ if (entry.kind.type === "step") {
2294
+ entry.kind.data.error = String(error);
2295
+ }
2296
+ entry.dirty = true;
2293
2297
  if (error instanceof StepTimeoutError) {
2294
- if (entry.kind.type === "step") {
2295
- entry.kind.data.error = String(error);
2296
- }
2297
- entry.dirty = true;
2298
2298
  metadata.status = "exhausted";
2299
2299
  metadata.error = String(error);
2300
- await this.flushStorage();
2301
2300
  await this.notifyStepError(config2, metadata.attempts, error, {
2302
2301
  willRetry: false
2303
2302
  });
@@ -2311,13 +2310,8 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
2311
2310
  );
2312
2311
  }
2313
2312
  if (error instanceof CriticalError || error instanceof RollbackError) {
2314
- if (entry.kind.type === "step") {
2315
- entry.kind.data.error = String(error);
2316
- }
2317
- entry.dirty = true;
2318
2313
  metadata.status = "exhausted";
2319
2314
  metadata.error = String(error);
2320
- await this.flushStorage();
2321
2315
  await this.notifyStepError(config2, metadata.attempts, error, {
2322
2316
  willRetry: false
2323
2317
  });
@@ -2330,14 +2324,9 @@ var WorkflowContextImpl = class _WorkflowContextImpl {
2330
2324
  })
2331
2325
  );
2332
2326
  }
2333
- if (entry.kind.type === "step") {
2334
- entry.kind.data.error = String(error);
2335
- }
2336
- entry.dirty = true;
2337
2327
  const willRetry = metadata.attempts <= maxRetries;
2338
2328
  metadata.status = willRetry ? "failed" : "exhausted";
2339
2329
  metadata.error = String(error);
2340
- await this.flushStorage();
2341
2330
  if (willRetry) {
2342
2331
  const retryDelay = calculateBackoff(
2343
2332
  metadata.attempts,
@@ -4210,4 +4199,4 @@ export {
4210
4199
  runWorkflow,
4211
4200
  replayWorkflowFromStep
4212
4201
  };
4213
- //# sourceMappingURL=chunk-CIDHCIH7.js.map
4202
+ //# sourceMappingURL=chunk-EAAPMGGE.js.map