372
// resolveUnsuccessfully finalizes the operation. When fromAttempt is true, the failure is recorded as
373
// LastAttemptFailure. Otherwise the failure is recorded as the terminal Outcome.
374
>
func (o *Operation) resolveUnsuccessfully(ctx chasm.MutableContext, failure *failurepb.Failure, closeTime time.Time, fromAttempt bool) error {
operation.go
375
>
softassert.That(ctx.Logger(), failure != nil, "resolveUnsuccessfully called with nil failure")
376
>
if fromAttempt {
377
o.LastAttemptCompleteTime = timestamppb.New(ctx.Now(o))
378
o.LastAttemptFailure = failure
380
o.getOrCreateOutcome(ctx).Variant = &nexusoperationpb.OperationOutcome_Failed_{
381
Failed: &nexusoperationpb.OperationOutcome_Failed{Failure: failure},
382
}
383
}
384
>
o.ClosedTime = timestamppb.New(closeTime)
operation.go
385
>
386
>
// NextAttemptScheduleTime is only valid in BACKING_OFF; clear on close
387
>
o.NextAttemptScheduleTime = nil
388
>
return nil
389
}
390