Skip to content

Commit

Permalink
More consistent error handling in doc
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
seppo0010 authored and garyburd committed Nov 12, 2017
1 parent 3da6ca0 commit 7ca4275
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
// }
// }
//
Expand Down

0 comments on commit 7ca4275

Please sign in to comment.