From 3ffbc1eb62dce8f52aabf850267afe2467ef764b Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Sat, 24 Aug 2013 00:42:01 +0100 Subject: [PATCH] Added error recovery --- rosella.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rosella.go b/rosella.go index f612985..1be991f 100644 --- a/rosella.go +++ b/rosella.go @@ -89,6 +89,15 @@ func NewServer() *Server { func (s *Server) Run() { go func() { for { + event := <-s.eventChan + defer func() { + if err := recover(); err != nil { + log.Printf("Recovered from panic()") + log.Printf("%s sent %q", event.client.nick, event.input) + log.Println(err) + } + }() + s.handleEvent(<-s.eventChan) } }()