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