瀏覽代碼

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.
Sebastian Waisbrot 8 年之前
父節點
當前提交
7ca4275b84
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      doc.go

+ 3 - 1
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
 //      }
 //  }
 //