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

dcf at torproject.org dcf at torproject.org
Sat Mar 30 19:36:57 UTC 2019


commit 5b96265e01cf5e82b9e82f9e9e05441ac5311245
Author: David Fifield <david at bamsoftware.com>
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 2a62e04..c58fd52 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
 	}
 	length := len(encodedSpec)
 	if uint64(length) > math.MaxUint32 {
@@ -205,7 +205,7 @@ func roundTrip(req requestSpec, outToBrowserChan chan<- []byte) (responseSpec, e
 		Request: req,
 	})
 	if err != nil {
-		panic(err)
+		return nil, err
 	}
 	outToBrowserChan <- message
 



More information about the tor-commits mailing list