MCPcopy Create free account
hub / github.com/bufbuild/buf / handleFileAnnotationSetRetError

Method handleFileAnnotationSetRetError

private/buf/bufctl/controller.go:1363–1383  ·  view source on GitHub ↗

handleFileAnnotationSetError will attempt to handle the error as a FileAnnotationSet, and if so, print the FileAnnotationSet to the writer with the given error format while returning ErrFileAnnotation. Otherwise, the original error is returned.

(retErrAddr *error)

Source from the content-addressed store, hash-verified

1361//
1362// Otherwise, the original error is returned.
1363func (c *controller) handleFileAnnotationSetRetError(retErrAddr *error) {
1364 if *retErrAddr == nil {
1365 return
1366 }
1367 var fileAnnotationSet bufanalysis.FileAnnotationSet
1368 if errors.As(*retErrAddr, &fileAnnotationSet) {
1369 writer := c.container.Stderr()
1370 if c.fileAnnotationsToStdout {
1371 writer = c.container.Stdout()
1372 }
1373 if err := bufanalysis.PrintFileAnnotationSet(
1374 writer,
1375 fileAnnotationSet,
1376 c.fileAnnotationErrorFormat,
1377 ); err != nil {
1378 *retErrAddr = err
1379 return
1380 }
1381 *retErrAddr = ErrFileAnnotation
1382 }
1383}
1384
1385// Implements [protoyaml.Validator] using [protovalidate.Validator]. This allows us to pass
1386// a [protovalidate.Validator] to the [protoencoding.NewYAMLUnmarshaler] and validate types

Callers 10

GetWorkspaceMethod · 0.95
GetImageMethod · 0.95
GetImageForWorkspaceMethod · 0.95
PutImageMethod · 0.95
GetMessageMethod · 0.95
PutMessageMethod · 0.95

Calls 1

PrintFileAnnotationSetFunction · 0.92

Tested by

no test coverage detected