Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Result ¶
Result represents the result of a computation that can fail. The Result type revolves around two notions of failure:
1. Computations can fail, but they can fail gracefully. Computations that fail gracefully do so by logging a diagnostic and returning a non-nil "bail" result.
2. Computations can fail due to bugs in Pulumi. Computations that fail in this manner do so by constructing a Result using the `Error`, `Errorf`, or `FromError` constructor functions.
Result is an interface so that it can be nullable. A function returning a pointer Result has the following semantics:
If the result is `nil`, the caller should proceed. The callee believes that the overarching plan can still continue, even if it logged diagnostics.
If the result is non-nil, the caller should not proceed. Most often, the caller should return this Result to its caller.
At the highest level, when a function wishes to return only an `error`, the `Error` member function can be used to turn a nullable `Result` into an `error`.
func Bail ¶
func Bail() Result
Bail produces a Result that represents a computation that failed to complete successfully but is not a bug in Pulumi.
func Error ¶
Error produces a Result that represents an internal Pulumi error, constructed from the given message.
func Errorf ¶
Errorf produces a Result that represents an internal Pulumi error, constructed from the given format string and arguments.
func FromError ¶
FromError produces a Result that wraps an internal Pulumi error. Do not call this with a 'nil' error. A 'nil' error means that there was no problem, and in that case a 'nil' result should be used instead.
func Merge ¶
Merge combines two results into one final result. It properly respects all three forms of Result (i.e. nil/bail/error) for both results, and combines all sensibly into a final form that represents the information of both.
func WrapIfNonNil ¶
WrapIfNonNil returns a non-nil Result if [err] is non-nil. Otherwise it returns nil.