[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [meek/master] These can be ordinary error returns, not panics.



commit f72a152760e912cd8c21ced335ad17fdea05a4e9
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Sat Mar 30 13:10:33 2019 -0600

    These can be ordinary error returns, not panics.
---
 webextension/native/main.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/webextension/native/main.go b/webextension/native/main.go
index 8771b72..44e2d82 100644
--- a/webextension/native/main.go
+++ b/webextension/native/main.go
@@ -127,7 +127,7 @@ func recvRequestSpec(r io.Reader) (requestSpec, error) {
 func sendResponseSpec(w io.Writer, spec responseSpec) error {
 	encodedSpec, err := json.Marshal(spec)
 	if err != nil {
-		panic(err)
+		return err
 	}
 	// len returns int, which is specified to be either 32 or 64 bits, so it
 	// will never be truncated when converting to uint64.
@@ -211,7 +211,7 @@ func roundTrip(req requestSpec, outToBrowserChan chan<- []byte) (responseSpec, e
 		Request: req,
 	})
 	if err != nil {
-		panic(err)
+		return nil, err
 	}
 	outToBrowserChan <- message
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits