From 7ca4275b84a9d500f68971c8c4a97f0ec18eb889 Mon Sep 17 00:00:00 2001 From: Sebastian Waisbrot Date: Sun, 12 Nov 2017 09:01:55 -0300 Subject: [PATCH] More consistent error handling in doc I noticed the example is actually wrong as the same block both calls `return` with no parameter and `return err`. I think it would be better to allow the code to be used directly. I added calls to log.Println as it was used on the other example as it might be more useful for newcomers to see error messages. --- doc.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc.go b/doc.go index f5ff082..060b13f 100644 --- a/doc.go +++ b/doc.go @@ -30,10 +30,12 @@ // for { // messageType, p, err := conn.ReadMessage() // if err != nil { +// log.Println(err) // return // } // if err := conn.WriteMessage(messageType, p); err != nil { -// return err +// log.Println(err) +// return // } // } //