You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform/internal/promising/errors.go

32 lines
967 B

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package promising
import (
"errors"
)
// ErrUnresolved is the error returned by a promise getter if the task
// responsible for resolving the promise returns before resolving the promise.
var ErrUnresolved error
func init() {
ErrUnresolved = errors.New("promise unresolved")
}
// ErrSelfDependent is the error type returned by a promise getter if the
// requesting task is depending on itself for its own progress, by trying
// to read a promise that it is either directly or indirectly responsible
// for resolving.
//
// The built-in error message is generic but callers can type-assert to
// this type to obtain the chain of promises that lead from the task
// to itself, possibly via other tasks that are themselves awaiting the
// caller to resolve a different promise.
type ErrSelfDependent []PromiseID
func (err ErrSelfDependent) Error() string {
return "task is self-dependent"
}