Changed order of operations in setError() so that the underlying error is reported.
authorChris Jones <chris@cjones.org>
Mon, 30 Sep 2013 20:33:50 -0600
changeset 164 6b527647086c
parent 163 3f891f7fe817
child 165 d3182a279bf4
Changed order of operations in setError() so that the underlying error is reported.
xmpp/xmpp.go
--- a/xmpp/xmpp.go	Mon Sep 30 20:31:25 2013 -0600
+++ b/xmpp/xmpp.go	Mon Sep 30 20:33:50 2013 -0600
@@ -294,8 +294,9 @@
 // there's already an error in the channel, discard the newer one in
 // favor of the older.
 func (cl *Client) setError(err error) {
-	cl.Close()
-	cl.setStatus(StatusError)
+	defer cl.Close()
+	defer cl.setStatus(StatusError)
+
 	if len(cl.error) > 0 {
 		return
 	}