Handling basic unrecoverable errors

Fix #43
This commit is contained in:
Mickael Remond
2019-06-07 15:23:23 +02:00
parent d45dd6a44a
commit 2d8d4516fd
8 changed files with 65 additions and 18 deletions

View File

@@ -23,13 +23,16 @@ func main() {
client, err := xmpp.NewClient(config)
if err != nil {
log.Fatal("Error: ", err)
log.Fatalf("%+v", err)
}
cm := xmpp.NewClientManager(client, nil)
cm.Start()
err = cm.Start()
// connection can be stopped with cm.Stop()
// connection state can be checked by reading cm.Client.CurrentState
if err != nil {
log.Fatal(err)
}
// Iterator to receive packets coming from our XMPP connection
for packet := range client.Recv() {