This includes a few changes: * The repo name -- and hence the Go modules -- changes from pulumi-fabric to pulumi. * The Node.js SDK package changes from @pulumi/pulumi-fabric to just pulumi. * The CLI is renamed from lumi to pulumi.
26 lines
896 B
Go
26 lines
896 B
Go
// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
|
|
|
|
package errors
|
|
|
|
import (
|
|
"github.com/pulumi/pulumi/pkg/diag"
|
|
"github.com/pulumi/pulumi/pkg/util/contract"
|
|
)
|
|
|
|
// errors tracks all existing errors, keyed by their unique ID.
|
|
var errors = make(map[diag.ID]*diag.Diag)
|
|
|
|
// newError registers a new error message underneath the given unique ID.
|
|
func newError(id diag.ID, message string) *diag.Diag {
|
|
contract.Assert(errors[id] == nil)
|
|
e := &diag.Diag{ID: id, Message: message}
|
|
errors[id] = e
|
|
return e
|
|
}
|
|
|
|
// newWarning registers a new warning message underneath the given unique ID.
|
|
func newWarning(id diag.ID, message string) *diag.Diag {
|
|
// At the moment, there isn't a distinction between errors and warnings; however, we use different functions just in
|
|
// case someday down the road there is, and so we don't have to go audit all callsites.
|
|
return newError(id, message)
|
|
}
|