pulumi/pkg/compiler/errors/new.go
joeduffy 35aa6b7559 Rename pulumi/lumi to pulumi/pulumi-fabric
We are renaming Lumi to Pulumi Fabric.  This change simply renames the
pulumi/lumi repo to pulumi/pulumi-fabric, without the CLI tools and other
changes that will follow soon afterwards.
2017-08-02 09:25:22 -07:00

27 lines
910 B
Go

// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
package errors
import (
"github.com/pulumi/pulumi-fabric/pkg/diag"
"github.com/pulumi/pulumi-fabric/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)
}