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.
This commit is contained in:
Sebastian Waisbrot 2017-11-12 09:01:55 -03:00 committed by Gary Burd
parent 3da6ca0cb6
commit 7ca4275b84
1 changed files with 3 additions and 1 deletions

4
doc.go
View File

@ -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
// }
// }
//