~themue/juju-core/go-worker-firewaller-machineunits

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package mstate

import (
	"errors"
	"fmt"
)

// errorContextf prefixes any error stored in err with text formatted
// according to the format specifier.  If err does not contain an error,
// errorContextf does nothing.
func errorContextf(err *error, format string, args ...interface{}) {
	if *err != nil {
		*err = errors.New(fmt.Sprintf(format, args...) + ": " + (*err).Error())
	}
}