Report and exit on unexpected error.

This commit is contained in:
Matt Goodall 2013-04-23 09:16:08 +01:00
parent 40fc5bc2ad
commit 0daeeda190
1 changed files with 10 additions and 2 deletions

View File

@ -51,9 +51,14 @@ func producer(args []string) {
}()
for stanza := range x.In {
switch v := stanza.(type) {
case error:
log.Fatal(v)
default:
log.Println(stanza)
}
}
}
func consumer(args []string) {
@ -95,8 +100,11 @@ func consumer(args []string) {
}()
for stanza := range x.In {
if _, ok := stanza.(*xmpp.Message); ok {
switch v := stanza.(type) {
case *xmpp.Message:
count++
case error:
log.Fatal(v)
}
}
}