From ec1722a8047a0142dcfe1110047842ee849e57c9 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 6 May 2018 01:05:52 +0200 Subject: [PATCH] handle panic() --- cmd/iface/main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/iface/main.go b/cmd/iface/main.go index 81beec3..dc68dea 100644 --- a/cmd/iface/main.go +++ b/cmd/iface/main.go @@ -17,6 +17,12 @@ func main(){ /* (2) Bind default controller */ serv.BindDefault(func(cli *ws.Client, receiver <-chan ws.Message, sender chan<- ws.Message, bc chan<- ws.Message){ + defer func(){ + if (recover() != nil) { + fmt.Printf("*** PANIC\n") + } + }() + for msg := range receiver { // if receive message -> send it back