result

package
v0.16.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TODO

func TODO() error

TODO returns an error that can be used in places that have not yet been adapted to use Results. Their use is intended to be temporary until Results are plumbed throughout the Pulumi codebase.

Types

type Result

type Result struct {
	// contains filtered or unexported fields
}

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 best used as a pointer type 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

func Error(msg string) *Result

Error produces a Result that represents an internal Pulumi error, constructed from the given message.

func Errorf

func Errorf(msg string, args ...interface{}) *Result

Errorf produces a Result that represents an internal Pulumi error, constructed from the given format string and arguments.

func FromError

func FromError(err error) *Result

FromError produces a Result that wraps an internal Pulumi error.

func (*Result) Error

func (r *Result) Error() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL