markFailed method
Future<void>
markFailed(
- String runId,
- Object error,
- StackTrace stack, {
- 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(),
);
}