MCPcopy Index your code
hub / github.com/coder/coder / DiagnosticsErrorString

Function DiagnosticsErrorString

coderd/dynamicparameters/error.go:118–137  ·  view source on GitHub ↗
(d hcl.Diagnostics)

Source from the content-addressed store, hash-verified

116}
117
118func DiagnosticsErrorString(d hcl.Diagnostics) string {
119 count := len(d)
120 switch {
121 case count == 0:
122 return "no diagnostics"
123 case count == 1:
124 return DiagnosticErrorString(d[0])
125 default:
126 for _, d := range d {
127 // Render the first error diag.
128 // If there are warnings, do not priority them over errors.
129 if d.Severity == hcl.DiagError {
130 return fmt.Sprintf("%s, and %d other diagnostic(s)", DiagnosticErrorString(d), count-1)
131 }
132 }
133
134 // All warnings? ok...
135 return fmt.Sprintf("%s, and %d other diagnostic(s)", DiagnosticErrorString(d[0]), count-1)
136 }
137}

Callers 1

ResponseMethod · 0.85

Calls 1

DiagnosticErrorStringFunction · 0.85

Tested by

no test coverage detected