handle panic()
This commit is contained in:
parent
86dba9aa0b
commit
ec1722a804
|
@ -17,6 +17,12 @@ func main(){
|
||||||
/* (2) Bind default controller */
|
/* (2) Bind default controller */
|
||||||
serv.BindDefault(func(cli *ws.Client, receiver <-chan ws.Message, sender chan<- ws.Message, bc chan<- ws.Message){
|
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 {
|
for msg := range receiver {
|
||||||
|
|
||||||
// if receive message -> send it back
|
// if receive message -> send it back
|
||||||
|
|
Loading…
Reference in New Issue