From b3a6429e0e06ed83c808e46f8bde34a6449dd29d Mon Sep 17 00:00:00 2001 From: Mickael Remond Date: Fri, 31 May 2019 19:41:32 +0200 Subject: [PATCH] Check for errors in component connect. --- cmd/xmpp_component/xmpp_component.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/xmpp_component/xmpp_component.go b/cmd/xmpp_component/xmpp_component.go index d433474..a4640ed 100644 --- a/cmd/xmpp_component/xmpp_component.go +++ b/cmd/xmpp_component/xmpp_component.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "log" "gosrc.io/xmpp" ) @@ -9,7 +10,9 @@ import ( func main() { component := MyComponent{Name: "Test Component", Category: "gateway", Type: "service"} component.xmpp = &xmpp.Component{Host: "service.localhost", Secret: "mypass"} - _ = component.xmpp.Connect("localhost:8888") + if err := component.xmpp.Connect("localhost:8888"); err != nil { + log.Fatal(err) + } for { packet, err := component.xmpp.ReadPacket()