Added error recovery
This commit is contained in:
parent
510f1adc7f
commit
3ffbc1eb62
@ -89,6 +89,15 @@ func NewServer() *Server {
|
|||||||
func (s *Server) Run() {
|
func (s *Server) Run() {
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
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)
|
s.handleEvent(<-s.eventChan)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user