MCPcopy
hub / github.com/hashicorp/hcl / Error

Method Error

diagnostic.go:107–117  ·  view source on GitHub ↗

error implementation, so that sets of diagnostics can be returned via APIs that normally deal in vanilla Go errors.

()

Source from the content-addressed store, hash-verified

105// error implementation, so that sets of diagnostics can be returned via
106// APIs that normally deal in vanilla Go errors.
107func (d Diagnostics) Error() string {
108 count := len(d)
109 switch count {
110 case 0:
111 return "no diagnostics"
112 case 1:
113 return d[0].Error()
114 default:
115 return fmt.Sprintf("%s, and %d other diagnostic(s)", d[0].Error(), count-1)
116 }
117}
118
119// Append appends a new error to a Diagnostics and return the whole Diagnostics.
120//

Callers 4

TestExpandUnknownBodiesFunction · 0.95
TestRefineValueSpecFunction · 0.95

Calls 1

ErrorMethod · 0.45

Tested by 4

TestExpandUnknownBodiesFunction · 0.76
TestRefineValueSpecFunction · 0.76