markFailed method

  1. @override
Future<void> markFailed(
  1. String runId,
  2. Object error,
  3. StackTrace stack, {
  4. bool terminal = false,
})
override

Marks the run as failed and records error and stack.

Implementation

@override
Future<void> markFailed(
  String runId,
  Object error,
  StackTrace stack, {
  bool terminal = false,
}) async {
  final state = _runs[runId];
  if (state == null) return;
  if (terminal) {
    _removeWatcherForRun(runId);
  }
  _runs[runId] = state.copyWith(
    status: terminal ? WorkflowStatus.failed : WorkflowStatus.running,
    lastError: {'error': error.toString(), 'stack': stack.toString()},
    ownerId: terminal ? null : state.ownerId,
    leaseExpiresAt: terminal ? null : state.leaseExpiresAt,
    updatedAt: _clock.now(),
  );
}