# HG changeset patch
# User Chris Jones <chris@cjones.org>
# Date 1380594830 21600
# Node ID 6b527647086c7901807f9da04ae75454d0e26d25
# Parent  3f891f7fe817f04fa3c9b8de8304d0a8a0833dfb
Changed order of operations in setError() so that the underlying error is reported.

diff -r 3f891f7fe817 -r 6b527647086c 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
 	}