Przeglądaj źródła

Return errors getting extensions when formatting text,
rather than writing the error to stderr.

David Symonds 10 lat temu
rodzic
commit
aece6fb931
1 zmienionych plików z 1 dodań i 5 usunięć
  1. 1 5
      proto/text.go

+ 1 - 5
proto/text.go

@@ -41,7 +41,6 @@ import (
 	"io"
 	"log"
 	"math"
-	"os"
 	"reflect"
 	"sort"
 	"strings"
@@ -669,10 +668,7 @@ func writeExtensions(w *textWriter, pv reflect.Value) error {
 
 		pb, err := GetExtension(ep, desc)
 		if err != nil {
-			if _, err := fmt.Fprintln(os.Stderr, "proto: failed getting extension: ", err); err != nil {
-				return err
-			}
-			continue
+			return fmt.Errorf("failed getting extension: %v", err)
 		}
 
 		// Repeated extensions will appear as a slice.