Skip to content

Commit 7ca4275

Browse files
seppo0010garyburd
authored andcommitted
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.
1 parent 3da6ca0 commit 7ca4275

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

doc.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@
3030
// for {
3131
// messageType, p, err := conn.ReadMessage()
3232
// if err != nil {
33+
// log.Println(err)
3334
// return
3435
// }
3536
// if err := conn.WriteMessage(messageType, p); err != nil {
36-
// return err
37+
// log.Println(err)
38+
// return
3739
// }
3840
// }
3941
//

0 commit comments

Comments
 (0)