MCPcopy
hub / github.com/ossf/scorecard / WithMessage

Function WithMessage

errors/public.go:46–53  ·  view source on GitHub ↗

WithMessage wraps any of the errors listed above. For examples, see errors/errors.md.

(e error, msg string)

Source from the content-addressed store, hash-verified

44// WithMessage wraps any of the errors listed above.
45// For examples, see errors/errors.md.
46func WithMessage(e error, msg string) error {
47 // Note: Errorf automatically wraps the error when used with `%w`.
48 if len(msg) > 0 {
49 return fmt.Errorf("%w: %v", e, msg)
50 }
51 // We still need to use %w to prevent callers from using e == ErrInvalidDockerFile.
52 return fmt.Errorf("%w", e)
53}
54
55// GetName returns the name of the error.
56func GetName(err error) string {

Callers 4

registerFunction · 0.92
GetFunction · 0.92
TestWithMessageFunction · 0.85
CreateInternalFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestWithMessageFunction · 0.68